Menu on custom toolbar actions

Hi, is there a way to show a menu (like the column chooser) on custom actions in the toolbar?

Image_4575_1724746328490

I want the user to be able to choose what method of filtering to use.

I have come closer by using the toolbar template. But is there a way to use the default ColumnChooser in combination with the template?


3 Replies 1 reply marked as answer

RR Rajapandi Ravi Syncfusion Team August 28, 2024 11:39 AM UTC

Hi Niels,


Greetings from Syncfusion support


After reviewing your shared information, we understand that you want to show a menu in the custom toolbar item with the combination of default column chooser and using this menu you like to choose the type of Filter and set it to the Grid. You can display both built-in and custom toolbar items in the Grid. Please refer the below documentation for more information.

Documentation: https://ej2.syncfusion.com/angular/documentation/grid/tool-bar/tool-bar-items#both-built-in-and-custom-items-in-toolbar


Based on your query we have prepared the sample and achieved your requirement by using the template property of the custom toolbar item. In this template, we have rendered the DropdownButton control and based on the item selection, using the select event of DropdownButton we have set the filter type to the Grid. Please refer the below code example and sample for more information.


App.component.ts

 

export class AppComponent {

    @ViewChild('grid')

    public grid: any;

 

    public items: any = [

        {

            text: 'Menu'

        },

        {

            text: 'Excel'

        },

        {

            text: 'FilterBar'

        },

        {

            text: 'CheckBox'

        }];

 

        select(args: any) { //select event of DropdownButton

            this.grid.filterSettings.type = args.item.text; //set the filter type to the Grid based on the selected item

        }

 

    ngOnInit(): void {

         this.filterSettings = { type: 'Menu' };

        //here we have defined both built and custom toolbar item. Using the template property we can render our DropdownButton in the toolbar

         this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel', 'ColumnChooser', {text: 'Filter Type', template: "#buttonmenu"}];

    }

}

 

App.component.html

 

<button id="buttonmenu" ejs-dropdownbutton [items]='items' (select)='select($event)' content='FilterType'></button>

 

 


Sample: https://stackblitz.com/edit/angular-bwtumr-r6fxng?file=src%2Fapp.component.ts,src%2Fapp.component.html


Screenshot:


Please get back to us if you need further assistance.


Regards,

Rajapandi R


Marked as answer

NV Niels Van Goethem August 28, 2024 11:42 AM UTC

Exactly what I need, thank you!



AR Aishwarya Rameshbabu Syncfusion Team August 29, 2024 09:45 AM UTC

Hi Niels,


We are happy to hear that the provided solution was helpful. Please get back to us if you need any other assistance.


Regards

Aishwarya R


Loader.
Up arrow icon