Approved
Last Updated: 09 May 2019 08:55 by ADMIN
Ken
Created on: 09 May 2019 08:51
Category: Grid
Type: Feature Request
2
Add the ability to use a function to show/hide toolbar buttons like it is for column commands

Hi,

The Kendo UI Grid has the ability to conditionally hide/show the command columns. But in order to hide some buttons from the toolbar, you need a dataBound handler. It will be useful to hide the "Create" button from non-admins, but be able to show the PDF and Excel Export or hide the entire toolbar.

toolbar: [
    { name: "create", visible:function(){ return isAdmin; } },
    { name: "reports" , visible: function(){ return isManager }},
    { name: "cancel" }
  ],

Currently, we need to use this dataBound handler:

.Events(e=>e.DataBound("onDataBound"))     
  
 function onDataBound(e) {
   if (true) { // the condition against which you want to show/hide the toolbar
     this.element.find(".k-grid-toolbar").hide(); // hides the entire toolbar
     this.element.find(".k-grid-add").hide(); // hides just the Create button
  }
}


Thank you in advance,
Ken

0 comments