jqgrid操作列循环显示三个按钮

首先ajax取数据

$.ajax(
{
type: "get",
url: "../../MECManage/TJYY/collect",
cache: false,
async: false,
data: { coljson: JSON.stringify(coljson) },
dataType: 'json',
error: function () {
alert("数据出错!");
},
success: function (data) {

DrawListTwo(data,gridTables)

//后面的参数是放表格table的ID

}

function DrawListTwo(data, id) {
var colModelData = [{ name: "clus_code", label: "编号", hidden: true },

{ name: "clus_name", index: "clus_name", label: "套餐", width: 130 }, { name: "price", label: "价格", width: '55px' }, {
name: "process",
index: "process",
label: "操作",
width: 125,
sortable: true,
align: 'center'
}
];
var $gridTables = $("#" + id);
$gridTables.jqGrid({
datatype: "local",
styleUI: 'Bootstrap',
data: data.lnc,
height: 550,
autowidth: true,
colModel: colModelData,
sortorder: 'desc',
rownumbers: true,
shrinkToFit: false,
//height: 340,
viewrecords: true,
gridComplete: function () {
var ids = jQuery("#gridTables").jqGrid('getDataIDs');
for (var i = 0; i < ids.length; i++) {
var cl = ids[i];
update = "<input type='button' value='编辑' onclick='updateCollect(" + cl + ")'/>&nbsp;";
copy = "<input type='button' value='复制' onclick='deleteStu("
+ cl + ")'/>&nbsp;";
delet = "<input type='button' value='删除' onclick='viewStu("
+ cl + ")'/>";
jQuery("#gridTables").jqGrid('setRowData',
ids[i], {
process: update + copy + delet
});
}
}
});
}

上一篇:课程一(Neural Networks and Deep Learning),第一周(Introduction to Deep Learning)—— 0、学习目标


下一篇:Mac上搭建直播服务器Nginx+rtmp,实现手机推流、拉流