Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
80
rated 0 times [  85] [ 5]  / answers: 1 / hits: 16812  / 12 Years ago, mon, august 13, 2012, 12:00:00

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?


More From » kendo-ui

 Answers
25
function test(e){
return '<a class=k-button href=# id=toolbar-add_user onclick=test_fn()>Add User</a>';
};
function test_fn(){
window.location = http://www.google.com;
};
toolbar:[{
name:'add_user',
template:'#= test()#'
}],



  1. First i had to make a function to be able to customize the button and add an onclick event.

  2. Then i had to make a new function to listen to the event.


[#83663] Sunday, August 12, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lizette

Total Points: 252
Total Questions: 91
Total Answers: 103

Location: Sint Maarten
Member since Tue, Mar 29, 2022
2 Years ago
;