JqGrid 初始化数据

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>

转载于:https://my.oschina.net/clks/blog/336673

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值