将自定义滚动条应用于jqgrid后,排序无效

时间:2015-03-30 10:02:23

标签: javascript jquery jqgrid

我已将客户滚动条应用于div“ui-jqgrid-bdiv”,排序不适用于jqgrid。无需自定义滚动条排序工作正常。应用自定义滚动条后,单击列后会显示空白网格。

代码: -

 $(window).load(function(){
                $(".FilterContainer,.ui-jqgrid-bdiv").mCustomScrollbar({
                    scrollButtons:{enable:true},
                    theme:"light-thick"             
                });
});
     jQuery(gridOption).jqGrid({
    data: applyBestMachineData,
    datatype: "local",
    colNames:[displayName,'', 'kA$','%','kA$','%','kA$','%'],
    colModel:[    
        {name:'machineBestMachine',index:'machineBestMachine',width:350, sortable: false,classes: "machineBestMachinecol"},
        {name:'machineValue',index:'machineValue', width:60,sortable: false, classes: "machineValue"},
        {name:'applyBestMachineValue',index:'applyBestMachineValue', width:75,sortable: true, classes: "col2",sorttype:"text"},
        {name:'applyBestMachinePer',index:'applyBestMachinePer', width:75, align:"center", sortable: true,classes: "col1",sorttype:"text"},
        {name:'applyBestMachineOperation',index:'applyBestMachineOperation', width:65, align:"center",sortable: true, classes: "col2",sorttype:"text"},        
        {name:'applyBestMachineOperationPer',index:'applyBestMachineOperationPer', width:65,align:"right", sortable: false,classes: "col1"},        
        {name:'applyBothValue',applyBothValue:'applyBothValue', width:65,sortable: false, classes: "col2"},   
        {name:'applyBothPer',index:'applyBothPer', width:65,sortable: false, classes: "col1"}       
    ],
    rowNum:2000,
    rowTotal: 2000,         
    scroll:1,
    loadonce:true,
    mtype: "GET",
    rownumWidth: 40,
    gridview: true,
    autowidth: true,
    height:gridHeight,
    //sortable: false,          
    viewrecords: true, 
    onSelectRow: function(id) {     
        var rowData = jQuery(this).getRowData(id);       
        var machineBestMachineVar = rowData['machineBestMachine'];
        var machineBestMachineValue = machineBestMachineVar.split('<');     
        openEvaluationItemDetailPopUp(machineBestMachineValue[0]);
    },
    loadComplete: function() {
        //alert(this);

        $(gridOption+" tr:even").addClass('myAltRowClassEven');          
         $(gridOption+" tr:odd").addClass('myAltRowClassOdd');

            // $("#applyMachineGrid tr:even").addClass('myAltRowClassEven');             
            // $("#applyMachineGrid tr:odd").addClass('myAltRowClassOdd');

         }
});

1 个答案:

答案 0 :(得分:1)

我得到了答案: -   只需删除scroll = 1属性

即可