integrating KENDOUI toolbar with grid toolbar

2019-09-19 14:52发布

问题:

i want to integrate KENDOUI toolbar toolbar with basic CRUD toolbar operation of KENDOUI grid grid. I want to have button 'create' in my basic toolbar (first link) that adds new line in my grid(second link).

回答1:

I don't think you can combine the Kendo ToolBar widget with the built-in grid toolbar but you can completely define the grid's toolbar using a template which can be a Kendo ToolBar that you have complete control over.

http://dojo.telerik.com/@Stephen/OJAbI

In this example I have taken the 2 demos you linked to and added the ToolBar from the ToolBar demo and added it as the toolbar for the Grid using the toolbar.template configuration:

toolbar: [
{
    template: '<div id="toolbar"></div>'
}],

Then, the "toolbar" element gets converted to a full ToolBar with

$("#toolbar").kendoToolBar({...});

in which I have added a "Add new record" button and the click handler of the ToolBar is

click: function(e) {
    $("#grid").getKendoGrid().addRow();
}