jQuery("#list").jqGrid({ url:'users.do', colNames:['流水号','姓名','性别','工号','入职时间','手机','职务','定位'], colModel:[ {name:'id',index:'id',hidden:true},//隐藏ID列 {name:'name',index:'name',width:50,editable:true}, {name:'sex',index:'sex',width:50,align:'center'}, {name:'jobNumber',index:'jobNumber',width:50,align:'center'}, {name:'entryTime',index:'entryTime',width:50,align:'center'}, {name:'phone',index:'phone',width:50,align:'center'}, {name:'post',index:'post',width:50,align:'center'}, {name:'id',index:'id',width:50,align:'center',formatter:editFmatter} ], pager: '#pager', width:980, height:340, rowNum:15, multiselect: true,//设置复选框 rowList:[20,30,40], sortname: 'name', sortorder: 'desc', caption: '列表' }).navGrid('#pager',{edit:false,add:false, del:false, search:false}); }); function editFmatter(cellvalue, options, rowObject) { return "<img src='../static/images/location.png' οnclick='openLocation("+cellvalue+")' style='cursor:pointer'/>"; } function openLocation(id){ window.showModalDialog("../locate/index.do",'a',"dialogWidth=815px;dialogHeight = 405px;help=0"); }
相关资源:jqGrid(jqueryGrid表格操作demo)