Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a function when custom toolbar is clicked in Kendo UI?

I want to create a custom toolbar. Here is my code:

toolbar:[{
    text: "Go to Add User Page",
    className: "k-grid-custom",
    imageClass: "k-add"
}],

function createUser(){
    alert('Hello World');
}

I want to call the function named createUser when this button(custom toolbar) is clicked. How to make it possible?

like image 684
Johndave Decano Avatar asked Dec 27 '22 19:12

Johndave Decano


1 Answers

You could add a unique class to the button and then use that class to bind to the click event.

toolbar:[{
    text: "Go to Add User Page",
    className: "myCustomClass",
    imageClass: "k-add"
}],

$(".myCustomClass").click(function() {
    alert("Click!");
});
like image 128
Jesper Avatar answered Dec 29 '22 07:12

Jesper