页面:
JS$(document).ready(function() {
$('#grid-table').jqGrid({
datatype: "json",
url: path + '/demo.action',
height: 351,
colNames:['ID','名称','邮箱', '操作'],
colModel:[
{name:'id',index:'id', width:'20', editable: false},
{name:'name',index:'name', width:'20'},
{name:'email',index:'email', width:'20'},
{name:'opt',index:'id', width:'30',fixed:false, sortable:false, resize:false,
align:'center',formatter:optFormatter
},
],
viewrecords : true,
rowNum:10,
rowList:[10,20,30],
pager : '#grid-pager',
altRows: true,
//toppager: true,
multiselect: true,
//multikey: "ctrlKey",
multiboxonly: true,
loadComplete : function() {
var table = this;
setTimeout(function(){
completeStyle(table);
updateActionIcons(table);
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
caption: "",
autowidth: true
});
function optFormatter(cellvalue, options, rowObject){
return "编辑";
}
// 加载完成后 更改样式
function completeStyle(table) {
// 更改checkbox样式
$(table).find('input:checkbox').addClass('ace')
.wrap('')
.after('');
$('.ui-jqgrid-labels th[id*="_cb"]:first-child')
.find('input.cbox[type=checkbox]').addClass('ace')
.wrap('').after('');
}
function updateActionIcons(table) {
var replacement =<