This is a migrated thread and some comments may be shown as answers.

Best method to change grid with different toolbar

2 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 22 Mar 2016, 06:17 PM
I have a grid that is either "readable" or "modifyable". This depends on the buttons a user clicks. If they click "readable", the grid should NOT display Insert, Edit, Delete buttons. If they click "modifyable", the grid SHOULD display the buttons. Is there a way to change the toolbar buttons without recreating the grid?

2 Answers, 1 is accepted

Sort by
0
Accepted
Stephen
Top achievements
Rank 2
answered on 23 Mar 2016, 08:45 PM

I never use the built-in grid toolbar, I always create my own full Kendo ToolBar and put it into the grid's toolbar area as a template.

This way, I am in full control of all aspects of the ToolBar and can put whatever I want in it, hide/show/disable/enable buttons as I see fit.

You may also be able to get a reference to the buttons you want to affect via something like

$("#myGrid > .k-grid-toolbar > .k-button.k-grid-add")

and then add/remove display:none or the disabled attribute in response to your readable/modifyable button click.

0
Andy
Top achievements
Rank 1
answered on 23 Mar 2016, 08:47 PM
This is pretty much what I ended up doing
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Stephen
Top achievements
Rank 2
Andy
Top achievements
Rank 1
Share this question
or