我希望捕获事件,当有人点击网格中的编辑按钮,我试图调用OnEdit函数,它没有为此工作任何解决方案?
<script>
// When user clicks on edit button command i would like to call this function.
function onEdit(e) {
alert('onEdit');
}
// Kendo grid code for populating the data from ajax call and edit function. This is starting point where all events and datasource is populated.
$(document).ready(function() {
dataSource = new kendo.data.DataSource({
transport: {
update: { // Update event
type: "POST",
url: BASE_URL + "admin/updatePublisher.htm",
contentType: "application/json; charset=utf-8",
dataType: "json"
success: function (result) { // success will save the data
options.success(result);
}
},
parameterMap: function(options, operation) { // Update is clicked or created this is place it will reach.
},
batch: true,pageSize: 50,
schema: {
type: "json",
model: {
id: "id",
fields: {
id: {
editable: false,nullable: true,type: "number"
}
}
},
data: "items" // the items return from ajax
},
}); // end of datasource
// Kendo UI $("#grid") . kendoGrid({dataSource:dataSource,navigatable:true,pageable:true,
toolbar:[{name:"create",text:"Add Publisher"}],//工具栏菜单栏:[{field:"publisherName"},{command:["edit"],title:"Actions"}],editable:"inline"}); });
1 回答
我找到了我的问题的解决方案,希望它对某人有用 . 在kendoGrid中编辑属性是我的问题的解决方案 .