function actionFormat(cellvalue, options, rowObject){ var id=rowObject.id; var moveout=''; moveout = "<a href='#' style='color:#f60' onclick='appointFun(\"" + id + "\")'>分配</a>|"; moveout+= "<a href='#' style='color:#f60' onclick='view(\"" + id + "\")' >详情</a>"; return moveout; } jQuery("#list") .jqGrid( { url : 'hqAssisstAppointListData.action', datatype : "JSON", mtype : 'POST', rownumbers : true, viewrecords : true, colNames : ['ID','11,'22,'33,'操作'], colModel : [ {name : 'id',index : 'id' , hidden : true ,key:true}, {name : 'customerDto.name',index :'customerDto.name',width : 20,align : 'center'}, {name : 'customerDto.classification',index :'customerDto.classification',width : 20,align : 'center' ,formatter:'select',editoptions:{value:{ '1':'1星','2':'2星', '3':'3星', '4':'4星', '5':'5星'}}}, {name : 'customerDto.industry',index :'customerDto.industry',width : 20,align : 'center'}, {name:'action',index:'id',width:20,align:"center",sortable:false,formatter:actionFormat}], viewrecords : true,//设置是否在Pager Bar显示所有记录的总数 multiboxonly: true, jsonReader : { root : "results", //list数据集合,数字形式 records : "record", //查询出来的总记录数 repeatitems : false //是否允许存在重复记录 },//后太返回的json数据 ondblClickRow : function(id) { }, altRows : true, altclass : 'altclass', caption : "总部协助分配", height : '100%', sortname : 'code', sortorder : 'desc', sortable : true, autowidth : true, rowNum : 10, pager : '#pghwcs', rowList : [ 10, 30, 50, 100 ] });
<table border="1" cellpadding="2" cellspacing="2" width="100%" align="center" id="list"> </table> <div id="pghwcs"></div>