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 });
}


},


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM