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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add a custom dropdown button to a grid toolbar

Thread ID:





151140 Jan 31,2020 09:33 PM UTC Mar 3,2020 06:21 AM UTC Angular - EJ 2 3
Tags: Grid
Asked On January 31, 2020 09:33 PM UTC

I want a dropdown list in the toolbar of the grid, like the columnChooser eg, I tried several options, but nothing works?

Thnxs in advanced

Balaji Sekar [Syncfusion]
Replied On February 3, 2020 11:04 AM UTC

Hi Arnaud, 
Greetings from Syncfusion. 
Query#:  Need  dropdown list in the toolbar of the grid, 
We have analyzed your query and prepared sample based on your requirement. In that sample we have rendered a dropdown button component in the toolbar using toolbarTemplate feature  and the options were given as items for the dropdown. The dropdown component has select event which will be triggered when select the option values. Using the select event we have performed some of the operations in the Grid like editing, updating, deleting of particular row. Documentation and sample link shared  to know more about the DropdownButton component. 
Code snippet: 
public onSelect(args: any): void { 
        if(args.item.text === 'Update'){ 
        if(args.item.text === 'Edit'){ 
        if(args.item.text === 'Delete'){ 
          this.grid.deleteRow(this.grid.getContent().querySelectorAll('.e-row')[0] as any); 

<ng-template #toolbarTemplate let-data> 
                            <button ejs-dropdownbutton [items]='items' (select)='onSelect($event)' content='Edit Options'></button>` 
Documentation Links: 
Please get back to us, if you need further assistance. 
Balaji Sekar. 

Replied On March 2, 2020 07:44 PM UTC


But the default Toolbar is gone. I want to comine it with the builtin actions eg ColumnChooser and SearchBox

Is that possible?


Balaji Sekar [Syncfusion]
Replied On March 3, 2020 06:21 AM UTC

Hi Arnaud, 
Query: “I want to combine it with the builtin actions e.g., ColumnChooser and SearchBox. Is that possible? 
Yes, we can combine the  the built-in toolbar items with custom components in the Grid toolbar. In below code example we have add custom component using template property of toolbar component in Grid.  
Please refer the below code example and sample for more information. 
<ejs-grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' [toolbar]='toolbar'> 
   . . . . 
<ng-template #template let-data> 
    <ejs-checkbox label="Checkbox" [indeterminate]="true"></ejs-checkbox> 

public toolbarTemplate: any; 
public sliderTemplate: any; 
public ngOnInit(): void { 
    this.data = orderDetails; 
    this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Dialog' }; 
    this.toolbar = ['Add', 'Edit', 'Delete', ‘Search’, {template: this.toolbarTemplate},  {template: this.sliderTemplate}]; 
    . . . . . 

Please get back to us if you need further assistance on this. 
Balaji Sekar. 


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