我确实在 Webix Datatable 中定义了按钮模板,如下所示:
grid = new webix.ui({
container: "permissions",
view: "datatable",
columns: [
{ id: "Id", adjust: "data", header: " ", template: "<button value='#Id#' class='btn btn-warning btn-xs edit'><i class='glyphicon glyphicon-pencil'></i></button> <button value=#Id# class='btn btn-danger btn-xs'><i class='glyphicon glyphicon-trash'></i></button>" }
...Other columns here
}
],
pager: {
container: "paging_here",
size: 10,
group: 5
},
autoheight: true,
minHeight: 50,
autowidth: true,
on: {
onBeforeLoad: function () {
this.showOverlay("Загрузка данных...");
},
onAfterLoad: function () {
this.hideOverlay();
}
},
url: "" + _args[0] + ""
});
不幸的是,我不知道如何获取按钮模板中定义的属性值。我尝试了类似的方法,但它不起作用:
grid.on_click.edit = function (e, id, trg, value) {
//Core.init(["../Permissions/Edit/?id=" + e.Id]);
//Core.loadModal();
alert($(this).attr("value"));
return false;
};