Hey,
I'm using a template to get a button into my grid toolbar since my atempt to write it analog to teh treelist doesn't work. But I can't access the click event. I want to open a custom create-dialog for grid items.
For the treelist i use something like this:
toolbar: [
{
imageClass: 'k-i-plus',
name: 'createPosition',
text: 'New',
click() {
$('#newItemDialog').data('kendoDialog').open();
},
},
'search',
]
Since this doesn't seem to work I tried this but can't access the click-event:
$myGrid.kendoGrid({
dataSource: myDatasource,
columns: [
....
],
toolbar: [
{
template: '<
a
class
=
"k-button"
href
=
"\\#"
id
=
"newItemButton"
">New</
a
><
span
class
=
"k-textbox k-grid-search k-display-flex"
><
input
autocomplete
=
"off"
placeholder
=
"Search..."
title
=
"Search..."
class
=
"k-input"
><
span
class
=
"k-input-icon"
><
span
class
=
"k-icon k-i-search"
></
span
></
span
></
span
>'
}
],
}).after(() => {
$('newItemButton').kendoButton({
icon: 'k-i-plus',
click: onNewClick
});
});
function onNewClick() {
$('#newItemDialog').data('kendoDialog').open();
}