JqGrid添加数据行中添加按钮

colNames: ['NewRequestId', 'Applicant', 'Applicant Department','Edit', 'Delete'], 
colModel: [
{ name: 'NewRequestId', index: 'NewRequestId', hidden: true, sortable: false, align: "center", width: "1px" },
{ name: 'ApplicatUserName', index: 'ApplicatUserName', sortable: false, align: "center", width: "120px" },
{ name: 'ApplicatDepartment', index: 'ApplicatDepartment', sortable: false, align: "center", width: "140px" },
{ name: 'Edit', index: 'Edit', sortable: false, align: "center", width: "100px" },

{ name: 'Delete', index: 'Delete', sortable: false, align: "center", width: "100px" }

],

 

在gridComplete事件中添加:

gridComplete: function () {
var ids = jQuery("#RequestList").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
var DeleteBtn = "<a href='#' style='color:#f60' onclick='OpenAllocationDialog()' >Abolish</a>";
var editBtn = "<a href='#' style='color:#f60' onclick='OpenAllocationDialog()' >Edit</a>";
jQuery("#RequestList").jqGrid('setRowData', ids[i], { Edit: editBtn, Delete: DeleteBtn });
}


},

posted @ 2012-09-07 10:43  小兔兔  阅读(12973)  评论(0编辑  收藏  举报