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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM