We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to use dropdownlist in template

Thread ID:

Created:

Updated:

Platform:

Replies:

149263 Nov 20,2019 09:28 AM UTC Nov 25,2019 04:29 PM UTC Angular - EJ 2 3
loading
Tags: TreeGrid
Sarathkumar, K (K.)
Asked On November 20, 2019 09:28 AM UTC

Hi Expert,

 How to use dropdownlist in template and call functions in JavaScript (ES5)


Thanks and Regards
Sarathkumar.K

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On November 21, 2019 05:12 PM UTC

Hi Sarathkumar, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked your query and we can place the Dropdownlist as Template column in TreeGrid and you can bind Javascript(ES5) functions from it. Refer to the code example:- 
 
<ejs-treegrid #treegrid [dataSource]='data' height='359' width='auto' childMapping='Children' [treeColumnIndex]='0' > 
        <e-columns> 
            .   .   
            <e-column  headerText='Tax per annum' width='90' textAlign='Center'> 
                <ng-template #template let-data> 
                    <ejs-dropdownlist id='games' #sample [dataSource]='sportsData' (change)='onChange($event)' [value]='value' [fields]='fields'></ejs-dropdownlist

                </ng-template> 
            </e-column> 
        </e-columns> 
    </ejs-treegrid> 

declare var myMethod: any; 

@Component({ 
    selector: 'app-root', 
    templateUrl: 'app.component.html', 

}) 
export class AppComponent { 
    public data: Object[] = []; 
    public sparkData: Object[] = []; 

  public sportsData: Object[] = [ 
        { Id: 'Game1', Game: 'American Football' }, 
        { Id: 'Game2', Game: 'Badminton' }, 
    ]; 
     public fields: Object = { text: 'Game', value: 'Id' }; 
    @ViewChild('treegrid') 
    public treegrid: TreeGridComponent; 

    ngOnInit(): void { 
        this.data = textdata; 
        myMethod(); 
   
    public onChange(args: any): void { 
        let value: Element = document.getElementById('value'); 
        let text: Element = document.getElementById('text'); 

   

// custom code end 


Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana  


Sarathkumar, K (K.)
Replied On November 22, 2019 09:53 AM UTC

Hi ,

Can you please provide sample in EJ5 javascript.
thanks
Sarath

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On November 25, 2019 04:29 PM UTC

Hi SarathKumar,

 

We have placed dropdownList as Template column and we have bind events(change event) for the Dropdownlist as like previous update.

 

Sample Link:- https://stackblitz.com/edit/angular-rssubz-mm2hsd?file=app.component.ts

 

Regards,

Farveen sulthana T


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon