override - add event listener for kendo grid command button -
i working on asp.net mvc4 application.in using kendo ui controls.
i using kendo grid.and want add event listener on kendo grid toolbar's "add new item" button.
below piece of code of grid command button:
.toolbar(commands => { commands.create(); commands.save(); })
and want overrides click event.actually want check condition on click event.and if condition returns true want button should enable otherwise should disable.
i have tried overrides of below codes not worked.
example:
1) '$(".k-button.k-button-icontext.k-grid-add").bind("click", function () { alert('add link event'); }); 2) $(".k-grid-add").on('click',function () { alert("hello"); }); 3) $(".k-button.k-button-icontext.k-grid-add").on("click", function () { alert('add link event'); }); '
but none of above working.
can suggest me way this?
thanks
use toolbar template create commands. allows specify onclick event.
.toolbar(commands => commands.template("<a class='k-button k-button-icontext' onclick='customcommand()' href='#'></span>create</a>"))
then can checking in js function customcommand().
more info on toolbar templates: http://docs.kendoui.com/api/web/grid#configuration-toolbar.template
Comments
Post a Comment