jqgrid分页多选

 
  
 
  
  
  
   
   
   
   
   
    
   
    
    
    
     
     
     
     
  1. type = "hidden" id = "selectedIds" value = "" />

 
 
 
  
  
  
  
  
   
  
   
   
   
    
    
    
    
  1. function optGrid(rowId, status){
  2. var ids = $("#selectedIds").val();
  3. ids = status==true ? (ids.indexOf(rowId) == -1? ids + rowId+",":ids) : ids.replace((rowId+","),"");
  4. $("#selectedIds").val(ids);
  5. }

 
  
 
  
  
  
   
   
   
   
   
    
   
    
    
    
     
     
     
     
  1. function load_authcode_jqGrid(){
  2. jQuery("#ajax_authcode_table").jqGrid({
  3. url:'ajax-authcode!list.action',
  4. datatype: "json",
  5. colNames:['注册码',"所属企业","当前状态","当前使用/已使用","绑定时间","剩余天数","创建时间",'创建人',"id"],
  6. colModel:[
  7. {name:'authCode',index:'authCode', width:120,sortable:true,search:false},
  8. {name:'company',index:'company', width:120,sortable:true,search:false},
  9. {name:'status',index:'status', width:80,search:false,formatter:statusFormat},
  10. {name:'use',index:'use', width:60,search:false},
  11. {name:'bindDate',index:'bindDate', width:60,search:false},
  12. {name:'days',index:'days', width:60,search:false},
  13. {name:'createDate',index:'createDate', width:80,search:false},
  14. {name:'creater',index:'creater_name', width:80,search:false},
  15. {name:'id',index:'id',hidden:true,search:false}
  16. ],
  17. rowNum : 10,
  18. rowList:[10,20,30],
  19. pager : '#ajax_authcode_list_page',
  20. gridComplete:function(){
  21. var dIds=$("#ajax_authcode_table").jqGrid('getDataIDs');
  22. var sIds = $("#selectedIds").val();
  23. for(var i=0;i<dIds.length;i++){
  24. if(sIds.indexOf(dIds[i])!=-1) $("#ajax_authcode_table").jqGrid("setSelection", dIds[i]);
  25. }
  26. $(".ui-jqgrid-bdiv").css("overflow-x","hidden");
  27. jqGridStyle();
  28. },
  29. caption : " 充值码一览",
  30. jsonReader: {
  31. root: "dataRows",
  32. page: "page",
  33. total: "total",
  34. records: "records",
  35. repeatitems : false
  36. },
  37. multiselect : true,
  38. rownumbers:true,
  39. gridview:true,
  40. shrinkToFit:true,
  41. viewrecords: true,
  42. autowidth: true,
  43. height:'auto',
  44. forceFit:true,
  45. onSelectRow:function(rowId, status, e){
  46. optGrid(rowId, status)
  47. },
  48. onSelectAll:function(aRowids, status, e){
  49. for(var i=0;i<aRowids.length;i++){
  50. optGrid(aRowids[i], status);
  51. }
  52. },
  53. loadComplete: function() {
  54. }
  55. });
  56. $(window).on('resize.jqGrid', function() {
  57. jQuery("#ajax_authcode_table").jqGrid('setGridWidth', $("#ajax_authcode_list_row").width());
  58. })
  59. jQuery("#ajax_authcode_table").jqGrid('navGrid', "#ajax_authcode_list_page", {
  60. edit : false,
  61. add : false,
  62. del : false,
  63. search:false
  64. });
  65. };



来自为知笔记(Wiz)


你可能感兴趣的:(jqgrid分页多选)