long press or right-click get a column dynamically

Hello!

I expect to get a column dynamically when I long press or right-click it. Which function can get it?




1 Reply

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team April 8, 2022 04:27 PM UTC

Hi TrinityJing,


Query#:- I expect to get a column dynamically when I long press or right-click it.


We have achieved your requirement by dynamically add the column into treegrid.columns and refresh the columns using refreshColumns method.


Refer to the code below:-

App.Component.ts

 

clicked(): void {

                   let columnName = { field: 'priority', width: 100 };

                   this.treegrid.columns.push(columnName); //Add the columns

                   this.treegrid.refreshColumns();

               }


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

API link:-https://ej2.syncfusion.com/angular/documentation/api/treegrid/#refreshcolumns


Likewise you can perform the above action on Context menu right click. If the above solution doesn’t meet your requirement, share further details on this.


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


Regards,
Farveen sulthana T


Loader.
Up arrow icon