Jquery 剑道网格UI已编辑值,但未保存
我想在有人单击网格中的编辑按钮时捕获事件。我正在尝试调用OnEdit函数,它不起作用,对此有什么解决方案吗Jquery 剑道网格UI已编辑值,但未保存,jquery,kendo-ui,kendo-grid,Jquery,Kendo Ui,Kendo Grid,我想在有人单击网格中的编辑按钮时捕获事件。我正在尝试调用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 a
<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.
//当用户点击编辑按钮命令时,我想调用这个函数。
功能OneEdit(e){
警报(“onEdit”);
}
//用于从ajax调用和编辑函数填充数据的剑道网格代码。
这是填充所有事件和数据源的起点
$(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"}], // toolbar menu
columns: [{field: "publisherName"},{ command: ["edit"], title: "Actions" }],
editable: "inline"
});
});
</script>
$(文档).ready(函数(){
dataSource=新建kendo.data.dataSource({
运输:{
更新:{//更新事件
类型:“POST”,
url:BASE_url+“admin/updatePublisher.htm”,
contentType:“应用程序/json;字符集=utf-8”,
数据类型:“json”
成功:函数(结果){//success将保存数据
选项。成功(结果);
}
},
parameterMap:功能(选项、操作){
//单击或创建更新时,它将到达此位置。
},
批次:true,页面大小:50,
模式:{
键入:“json”,
型号:{
id:“id”,
字段:{
身份证:{
可编辑:false,可空:true,键入:“number”
}
}
},
数据:“items”//items从ajax返回
},
});//数据源的结尾
//剑道拳
$(“#网格”).kendoGrid({
数据源:数据源,
可导航:是的,
pageable:对,
工具栏:[{name:“create”,文本:“addpublisher”}],//工具栏菜单
列:[{field:“publisherName”},{command:[“edit”],标题:“Actions”}],
可编辑:“内联”
});
});
我找到了问题的解决方案,希望对其他人有用。kendoGrid中的edit属性是我问题的解决方案
$("#grid").kendoGrid({
dataSource: dataSource,
navigatable: true,
pageable: true,
edit : function (e) {
// Write your code
},
height: 550,
toolbar: [{ name: "create", text: "Add Creater"}],
columns: [{
field: "emailCreativeName",
title: "Email Creater",
width: "350px"
},{ command: ["edit"], title: "Actions", width: "200px" }],
editable: "inline"
});