0

多选的列保存在网格参数中,当我使用保存的状态(getGridParam)重新加载网格时,我得到一个用于选择的双列,这弄乱了我的列顺序。

我加载参数之前的网格
前

后

这是代码:

jQuery("#list2").jqGrid({
    url:'jqgrid/server.php?q=2',
    datatype: "json",
    colNames:['a','UID','Phone', 'Message', 'created','replyed'],
    colModel:[
          {name:'action',index:'action', width:55,search:false,'sortable':false},
        {name:'id',index:'uid', width:55},
        {name:'phone_number',index:'phone_number', width:90,'editable':true},
        {name:'message',index:'message', width:500,'editable':true},
        {name:'created',index:'created', width:80, align:"right",'editable':true,stype:'select',edittype:"select",editoptions: {value:"Yes:Yes;No:No"}},
        {name:'replyed',index:'replyed', width:80, align:"right",'editable':true,edittype:"checkbox",editoptions: {value:"Yes:No"}},        
    ],
    rowNum:50,
    toolbar: true,
    height: '100%',
    width: 800,
    rowList:[10,20,50,100,300,1000],
    pager: '#pager2',
    sortname: 'uid',
    sortable:true,
    viewrecords: true,
    sortorder: "desc",  
    caption:"Pilote",
    gridview : true,
    multiselect: true,
});


function saveStateGrid(){
     state = $('#list2').getGridParam();
     localStorage.setItem("gridState", JSON.stringify(state));
}
function loadStateGrid(){
    state = JSON.parse(localStorage.getItem('gridState'));
    jQuery("#list2").GridUnload("#list2");
    //state.multiselect = false;
    $('#list2').jqGrid(state);
    $('#list2').trigger('reloadGrid');
}
4

0 回答 0