这些代码用于从 ajax 获取命令数据,它正在工作:
function command(){
var res;
$.ajax({
url: "../data/sys_user.service.php?method=getUserCommand&onpage="+"<?php echo EL::CurPage(); ?>",
async:false,
success: function (json) {var r = $.parseJSON(json);res=r;},
error: function (jqXHR, textStatus, errorThrown) {alert(jqXHR.responseText);},
complete: function(){}
});
return res;
};
该函数返回 json 数据,如:
[
{"id":22,"text":"Edit","name":"edit"},
{"id":23,"text":"Remove","name":"destroy"},
{"id":45,"text":"Change Password","name":"changeUserPwd","click":"changeUserPwd"}
]
当然,Kendo-ui 网格视图可以使用结果,并且网格命令“编辑”和“删除”正在工作:
.....
columns: [
{ field: "id", title:"#", width:20,filterable: false},
{ field: "username", title:"Username", width:100},
{ field: "userpwd", title:"Password", width:200, filterable: false, hidden:true},
{ field: "name", title:"Name", width:100 },
{ field: "email", title:"E-Mail" ,width:200 },
{ command: command(),},
],
.....
function changeUserPwd(e){
alert('Change Password !');
}
现在,问题是“更改密码”命令在单击时什么也不做。
如何在使用远程数据的命令上绑定事件。
谢谢!