Load Grid toolbar dynamically

Hi

I want to load Grid toolbar which is custom. I am doing this through service.

I have one variable which have value

this.gridStepActions=
[{ text: 'Delete', tooltipText: 'Cancel', prefixIcon: 'close_black_Icon', id: '421', align: 'Left' },{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'Edit_Icon', id: '422', align: 'Left' },{ text: 'Review', tooltipText: 'Review', prefixIcon: 'Review_Icon', id: '430', align: 'Left' },{ text: 'Next', tooltipText: 'Submit', prefixIcon: 'drag_Icon', id: '76', align: 'Left' },{ text: 'Withdraw', tooltipText: 'Withdraw1', prefixIcon: 'withdraw_Icon', id: '1773', align: 'Left' }]

when I am assiging 
this.toolbar=this.gridStepActions(not working)
and when assigning same value directly(see below) then it works :-

this.toolbar=[{ text: 'Delete', tooltipText: 'Cancel', prefixIcon: 'close_black_Icon', id: '421', align: 'Left' },{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'Edit_Icon', id: '422', align: 'Left' },{ text: 'Review', tooltipText: 'Review', prefixIcon: 'Review_Icon', id: '430', align: 'Left' },{ text: 'Next', tooltipText: 'Submit', prefixIcon: 'drag_Icon', id: '76', align: 'Left' },{ text: 'Withdraw', tooltipText: 'Withdraw1', prefixIcon: 'withdraw_Icon', id: '1773', align: 'Left' }]

Kindly suggest because my toolbar value change on every tab click.

1 Reply

SK Sujith Kumar Rajkumar Syncfusion Team March 24, 2020 10:21 AM UTC

Hi Namita, 

Greetings from Syncfusion support. 

We checked your reported problem – “Dynamically modify Grid’s toolbar items” but unfortunately were unable to reproduce it from our end as the toolbar items were updated properly. Please check below sample for your reference where we have dynamically changed the grid toolbar’s items with your mentioned values, 


It would be helpful to identify your problem better if you could share the following information, 

  • Are any console errors thrown? Is so please share it.
  • Syncfusion package version used.
  • Entire Grid related code.
  • If possible provide us a simple sample to replicate the problem or try reproducing it in the above provided sample.

Let us know if you have any concerns. 

Regards, 
Sujith R 


Loader.
Up arrow icon