disable/enable items in toolbar grid


I need to disable some toolbar buttons:
      this.grid.toolbarModule.enableItems(['Grid_Add''Grid_Edit''Gird_Delete'], false); // Disable toolbar items.
It works very well but when it finishes loading at some point it re-enables the buttons.
html:
<ejs-grid #grid [sortSettings]='sortOptions' [allowSelection]="true" [allowPaging]="true" [allowGrouping]="true"
            [allowSorting]="true" [pageSettings]="pageSettings" [searchSettings]="searchSettings"
            [allowFiltering]="true" [allowExcelExport]='true' [filterSettings]='filterSettings'
            [selectionSettings]='selectionSettings' [dataSource]='eventsData' [allowTextWrap]='true'
            [editSettings]='editSettings' [toolbar]='toolbar' (actionComplete)='actionComplete($event)'
            (actionBegin)='actionBegin($event)' (rowSelected)='rowSelected($event)' (dataBound)='disable($event)'>






1 Reply 1 reply marked as answer

TS Thiyagu Subramani Syncfusion Team August 17, 2020 11:43 AM UTC

Hi Pablo, 

Thanks for contacting Syncfusion forum. 

Based on your shared information we suggest to disable some specific toolbar items in dataBound Event. Please refer to the below code and sample. 

In this below sample we have disabled toolbar items using flag variables. 

dataBound(args) { 
    if (this.flag) { 
      this.grid.toolbarModule.enableItems(['Grid_add', 'Grid_edit', 'Grid_delete'], false); 
      this.flag = false; 
    } 
  } 



 

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

Regards, 
Thiyagu S. 


Marked as answer
Loader.
Up arrow icon