これらのコードは 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 !');
}
ここでの問題は、コマンド「パスワードの変更」をクリックしても何もしないことです。
リモート データを使用するコマンドにイベントをバインドする方法。
ありがとう!