I have a grid that I'm using the default popup editing for. I also am using a custom toolbar template. What I'd like to do is use the "create" command that can usually be used in the toolbar, within my custom toolbar template. Is this possible? Below is my code and any help would be greatly appreciated!
<
script
type
=
"text/x-kendo-template"
id
=
"template"
>
<
div
class
=
"toolbar"
>
<
span
class
=
"grid-heading"
>All Users</
span
>
<
span
name
=
"create"
class
=
"btn btn-link pull-right"
id
=
"createUser"
><
i
class
=
"fa fa-user-plus"
></
i
> Add New</
span
>
</
div
>
</
script
>
var grid = $("#UserListGrid").kendoGrid({
dataSource: viewModel.get("userDataSource"),
sortable: true,
pageable: true,
scrollable: false,
filterable: {
extra: false
},
toolbar: kendo.template($("#template").html()),
columns: [
{
field: "DisplayName", title: "Display Name", template: "#:DisplayName#"
},
{
field: "Email", template: "#:Email#"
},
{
field: "PhoneNumber", title: "Phone Number", template: "#:PhoneNumber#"
},
{
command: [
{ name: "edit", text: "Edit", className: 'small btn btn-link editUser', imageClass: 'fa fa-pencil' },
{ name: "destroy", text: "Delete", className: 'small btn btn-link danger', imageClass: 'fa fa-trash' }],
width: "160px"
}
],
editable: {
mode: "popup",
template: kendo.template($("#userEditor").html()),
"confirmation": "Are you sure you want to delete this user?"
},
edit: function (e) {
var editWindow = this.editable.element.data("kendoWindow");
editWindow.wrapper.css({ width: 450 });
e.container.find("#roleUpdate").kendoComboBox({
dataTextField: "Name",
dataValueField: "Id",
placeholder: "--Select Value--",
dataSource: new kendo.data.DataSource({
schema: {
model: {
id: "RoleId"
}
},
transport: {
read: {
url: "/User/GetAllRoles",
dataType: "json"
}
}
})
});
}
}).data("kendoGrid");