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
close icon

How to show or hide the delete button in the toolbar in Angular Grid

Hi,

I want to show delete button follow by condition, how to show or hide the delete button in the toolbar? Thanks

1 Reply 1 reply marked as answer

TS Thiyagu Subramani Syncfusion Team September 23, 2020 05:39 AM UTC

Hi lorryl, 

Thanks for contacting Syncfusion support. 

Query : I want to show delete button follow by condition, how to show or hide the delete button in the toolbar?. 
 
Based on your reported information we have achieved your requirement using button click event. In this event we have hided/showed Delete toolbar button using below code. Please refer to the below code and sample link. 
 
btnClick(){ 
        (this.grid.toolbarModule as any).element.querySelectorAll('#Grid_delete')[0].style.display = 'none'; 
   } 
   btnClick1(){ 
         (this.grid.toolbarModule as any).element.querySelectorAll('#Grid_delete')[0].style.display = 'block'; 
   } 
 
 
(Or ) if you want to enable/disable the toolbar items in Grid. We have already discuss about the above mentioned query in the following documentation link. Please refer it. 


For reference: 

 btnClick(args){ 
        this.grid.toolbarModule.enableItems(['Grid_delete'], false);   
   } 
   btnClick1(args){ 
            this.grid.toolbarModule.enableItems(['Grid_delete'], true);   
   } 

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

Regards, 
Thiyagu S 


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon