jqGrid設置多級表頭(包含凍結列,合併相同行,多級表頭)

效果1如圖:ide

js代碼以下:測試

  //初始化全部grid
function initAllGrid(){
        var colModel = [{label:'省(區、市)',name:'provice',index:'provice', width:90,align:"center",frozen:true,
                            cellattr: function(rowId, tv, rawObject, cm, rdata) {
                                  //合併單元格
                                 return 'id=\'provice' + rowId + "\'";
                            }
                },{label:'地市(鎮、區)',name:'area_name',index:'area_name', width:90, align:"center",frozen:true,
                    cellattr: function(rowId, tv, rawObject, cm, rdata) {
                          //合併單元格
                         return 'id=\'area_name' + rowId + "\'";
                    }
                },{label:'核心機樓名稱',name:'csb_name',index:'csb_name', width:110,align:"center",frozen:true
                },{label:'月份',name:'time_id',index:'time_id', width:90, align:"center"
                },//市電停電狀況
                {label:'一路市電停電次數(次)',name:'ac1_pf_times',index:'ac1_pf_times', width:150, align:"center"
                },{label:'一路市電停電總時長(分鐘)',name:'ac1_pf_duration',index:'ac1_pf_duration', width:170, align:"center"
                },{label:'兩路市電同時停電次數',name:'ac2_pf_times',index:'ac2_pf_times', width:150, align:"center"
                },{label:'兩路市電同時停電總時長(分鐘)',name:'ac2_pf_duration',index:'ac2_pf_duration', width:150, align:"center"
                },//油機使用狀況(不包含測試)
                {label:'市電停電後油機啓動邏輯',name:'oe_startup_logic',index:'oe_startup_logic', width:150,align:"center"
                },{label:'油機啓動方式',name:'oe_startup',index:'oe_startup', width:100, align:"center"
                },{label:'油機實際啓動次數(次)',name:'oe_startup_times',index:'oe_startup_times', width:110, align:"center"
                },{label:'油機實際啓動總時長(分鐘)',name:'oe_startup_duration',index:'oe_startup_duration', width:150, align:"center"
                }];
        _initGrid('con_grid_div_grid',colModel,470,15);
    }

//初始化grid的方法
    function _initGrid(gridType,colModel,height,rownum){//
        var me = this;
        $("#"+gridType).jqGrid({
            height: height,
            rowNum : rownum,
            scrollOffset :0,
            datatype: "local",
            colModel:colModel,
            autowidth : false,
            shrinkToFit : false,
            autoScroll: true,
            pager: "#"+gridType+"Pager",
            gridComplete: function() {
                //②在gridComplete調用合併方法
                var gridName = gridType;
                Merger(gridName, 'provice');
                Merger(gridName, 'area_name');
            }
        });
 //公共調用方法
        function Merger(gridName, CellName) {
             //獲得顯示到界面的id集合
            var mya = $("#" + gridName + "").getDataIDs();
            //當前顯示多少條
            var length = mya.length;
            for (var i = 0; i < length; i++) {
                 //從上到下獲取一條信息
                 var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
                 //定義合併行數
                 var rowSpanTaxCount = 1;
                 for (j = i + 1; j <= length; j++) {
                    //和上邊的信息對比 若是值同樣就合併行數+1 而後設置rowspan 讓當前單元格隱藏
                     var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
                     if (before[CellName] == end[CellName]) {
                         rowSpanTaxCount++;
                         $("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
                     } else {
                         rowSpanTaxCount = 1;
                         break;
                     }
                     $("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
                 }
            }
        }
$("#"+gridType).jqGrid('setGroupHeaders',{
             useColSpanStyle: true, 
             groupHeaders:[
                     {startColumnName : 'ac1_pf_times',numberOfColumns : 4,titleText : '市電停電狀況'},
                     {startColumnName : 'oe_startup_logic',numberOfColumns : 4,titleText : '油機使用狀況(不包含測試)'},
                     {startColumnName : 'ac1_pf_duration_per',numberOfColumns : 4,titleText : '最長時長統計'}
                 ]    
            });
        
        $("#"+gridType).jqGrid('setFrozenColumns');//滑動時此列凍結設置
    }  
View Code

    //初始化全部grid
function initAllGrid(){
        var colModel = [{label:'省(區、市)',name:'provice',index:'provice', width:90,align:"center",frozen:true,
                            cellattr: function(rowId, tv, rawObject, cm, rdata) {
                                  //合併單元格
                                 return 'id=\'provice' + rowId + "\'";
                            }
                },{label:'地市(鎮、區)',name:'area_name',index:'area_name', width:90, align:"center",frozen:true,
                    cellattr: function(rowId, tv, rawObject, cm, rdata) {
                          //合併單元格
                         return 'id=\'area_name' + rowId + "\'";
                    }
                },{label:'核心機樓名稱',name:'csb_name',index:'csb_name', width:110,align:"center",frozen:true
                },{label:'月份',name:'time_id',index:'time_id', width:90, align:"center"
                },//市電停電狀況
                {label:'一路市電停電次數(次)',name:'ac1_pf_times',index:'ac1_pf_times', width:150, align:"center"
                },{label:'一路市電停電總時長(分鐘)',name:'ac1_pf_duration',index:'ac1_pf_duration', width:170, align:"center"
                },{label:'兩路市電同時停電次數',name:'ac2_pf_times',index:'ac2_pf_times', width:150, align:"center"
                },{label:'兩路市電同時停電總時長(分鐘)',name:'ac2_pf_duration',index:'ac2_pf_duration', width:150, align:"center"
                },//油機使用狀況(不包含測試)
                {label:'市電停電後油機啓動邏輯',name:'oe_startup_logic',index:'oe_startup_logic', width:150,align:"center"
                },{label:'油機啓動方式',name:'oe_startup',index:'oe_startup', width:100, align:"center"
                },{label:'油機實際啓動次數(次)',name:'oe_startup_times',index:'oe_startup_times', width:110, align:"center"
                },{label:'油機實際啓動總時長(分鐘)',name:'oe_startup_duration',index:'oe_startup_duration', width:150, align:"center"
                },//最長時長統計
                {label:'一路市電停電單次最大時長(分鐘)',name:'ac1_pf_duration_per',index:'ac1_pf_duration_per', width:230, align:"center"
                },{label:'兩路市電停電單次最大時長(分鐘)',name:'ac2_pf_duration_per',index:'ac2_pf_duration_per', width:220, align:"center"
                },{label:'油機帶載單次最大時長(分鐘)',name:'oe_load_duration_per',index:'oe_load_duration_per', width:210, align:"center"
                },{label:'蓄電池組單次放電最大時長(分鐘)',name:'bat_discharge_duration_per',index:'bat_discharge_duration_per', width:230, align:"center"
                },//蓄電池放電狀況統計
                {label:'蓄電池組放電次數(組.次)',name:'bat_discharge_times',index:'bat_discharge_times', width:190, align:"center"
                },{label:'蓄電池組放電總時長(組.分鐘)',name:'bat_discharge_duration',index:'bat_discharge_duration', width:190, align:"center"
                },
                {label:'交流系統可用度',name:'acs_avail',index:'acs_avail', width:100, align:"center"
                },{label:'直流系統可用度',name:'dcs_avail',index:'dcs_avail', width:100, align:"center"
                }];
        _initGrid('con_grid_div_grid',colModel,470,15);
    }

//初始化grid的方法
    function _initGrid(gridType,colModel,height,rownum){//
        var me = this;
        $("#"+gridType).jqGrid({
            height: height,
            rowNum : rownum,
            scrollOffset :0,
            datatype: "local",
            colModel:colModel,
            autowidth : false,
            shrinkToFit : false,
            autoScroll: true,
            pager: "#"+gridType+"Pager",
            gridComplete: function() {
                //②在gridComplete調用合併方法
                var gridName = gridType;
                Merger(gridName, 'provice');
                Merger(gridName, 'area_name');
            }
        });
 //公共調用方法
        function Merger(gridName, CellName) {
             //獲得顯示到界面的id集合
            var mya = $("#" + gridName + "").getDataIDs();
            //當前顯示多少條
            var length = mya.length;
            for (var i = 0; i < length; i++) {
                 //從上到下獲取一條信息
                 var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
                 //定義合併行數
                 var rowSpanTaxCount = 1;
                 for (j = i + 1; j <= length; j++) {
                    //和上邊的信息對比 若是值同樣就合併行數+1 而後設置rowspan 讓當前單元格隱藏
                     var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
                     if (before[CellName] == end[CellName]) {
                         rowSpanTaxCount++;
                         $("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
                     } else {
                         rowSpanTaxCount = 1;
                         break;
                     }
                     $("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
                 }
            }
        }
$("#"+gridType).jqGrid('setGroupHeaders',{
             useColSpanStyle: true, 
             groupHeaders:[
                     {startColumnName : 'ac1_pf_times',numberOfColumns : 4,titleText : '市電停電狀況'},
                     {startColumnName : 'oe_startup_logic',numberOfColumns : 4,titleText : '油機使用狀況(不包含測試)'},
                     {startColumnName : 'ac1_pf_duration_per',numberOfColumns : 4,titleText : '最長時長統計'},
                     {startColumnName : 'bat_discharge_times',numberOfColumns : 2,titleText : '蓄電池放電狀況統計'}
                 ]    
            });
        
        $("#"+gridType).jqGrid('setFrozenColumns');//滑動時此列凍結設置
    } 

效果2如圖:this

js代碼以下:spa

define([], function() {
    
    function initTab(){
        initAllGrid();
        $('i[name="reportSearch"]').live("click",function(){  //過濾
            $("#search_con_grid_div_grid").click();
        });
    }
    //初始化全部grid
    function initAllGrid(){
        var colModel = [{label:'省(區、市)',name:'provice',index:'provice', width:90,align:"center",frozen:true,
                            cellattr: function(rowId, tv, rawObject, cm, rdata) {
                                  //合併單元格
                                 return 'id=\'provice' + rowId + "\'";
                            }
                },{label:'地市(鎮、區)',name:'area_name',index:'area_name', width:90, align:"center",frozen:true,
                    cellattr: function(rowId, tv, rawObject, cm, rdata) {
                          //合併單元格
                         return 'id=\'area_name' + rowId + "\'";
                    }
                },{label:'月份',name:'time_id',index:'time_id', width:80, align:"center"
                },//核心機樓
                {label:'核心機樓數量',name:'csb_cnt',index:'csb_cnt', width:90, align:"center"
                },{label:'歸入監控的數量',name:'csb_monit_cnt',index:'csb_monit_cnt', width:100, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t1',index:'t1', width:130, align:"center"
                },//傳輸匯聚節點機房
                {label:'傳輸匯聚節點機房數量',name:'tnsr_cnt',index:'tnsr_cnt', width:140,align:"center"
                },{label:'歸入監控的數量',name:'tnsr_monit_cnt',index:'tnsr_monit_cnt', width:100, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t2',index:'t2', width:130, align:"center"
                },//固定油機-核心機樓
                {label:'固定油機數量(臺)',name:'csb_foe_cnt',index:'csb_foe_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'csb_foe_monit_cnt',index:'csb_foe_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t3',index:'t3', width:130, align:"center"
                },//固定油機-傳輸匯聚機房
                {label:'固定油機數量(臺)',name:'tnsr_foe_cnt',index:'tnsr_foe_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'tnsr_foe_monit_cnt',index:'tnsr_foe_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t4',index:'t4', width:130, align:"center"
                }];
        _initGrid('con_grid_div_grid',colModel,470,15);
    }
    //初始化grid的方法
    function _initGrid(gridType,colModel,height,rownum){//
        var me = this;
        $("#"+gridType).jqGrid({
            height: height,
            rowNum : rownum,
            scrollOffset :0,
            datatype: "local",
            colModel:colModel,
            autowidth : false,
            shrinkToFit : false,
            autoScroll: true,
            pager: "#"+gridType+"Pager",
            gridComplete: function() {
                //②在gridComplete調用合併方法
                var gridName = gridType;
                Merger(gridName, 'provice');
                Merger(gridName, 'area_name');
            }
        });
        
         //公共調用方法
        function Merger(gridName, CellName) {
             //獲得顯示到界面的id集合
            var mya = $("#" + gridName + "").getDataIDs();
            //當前顯示多少條
            var length = mya.length;
            for (var i = 0; i < length; i++) {
                 //從上到下獲取一條信息
                 var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
                 //定義合併行數
                 var rowSpanTaxCount = 1;
                 for (j = i + 1; j <= length; j++) {
                    //和上邊的信息對比 若是值同樣就合併行數+1 而後設置rowspan 讓當前單元格隱藏
                     var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
                     if (before[CellName] == end[CellName]) {
                         rowSpanTaxCount++;
                         $("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
                     } else {
                         rowSpanTaxCount = 1;
                         break;
                     }
                     $("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
                 }
            }
        }
        
        $("#"+gridType).setComplexGroupHeaders({
             useColSpanStyle: true, 
             groupHeaders:[//二級表頭
                 {startColumnName:"csb_cnt",numberOfColumns:3,titleText:"核心機樓"},                 {startColumnName:"tnsr_cnt",numberOfColumns:3,titleText:"傳輸匯聚節點機房"},                 {startColumnName:"csb_foe_cnt",numberOfColumns:3,titleText:"核心機樓"},              {startColumnName:"tnsr_foe_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"},             {startColumnName:"csb_tf_cnt",numberOfColumns:3,titleText:"核心機樓"},               {startColumnName:"tnsr_tf_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"} ],
             complexGroupHeaders:[//三級表頭,和二級表頭用法同樣                {startColumnName:"csb_foe_cnt",numberOfColumns:6,titleText:"固定油機"},               {startColumnName:"csb_tf_cnt",numberOfColumns:6,titleText:"變壓器"},               {startColumnName:"csb_bat_cnt",numberOfColumns:6,titleText:"鉛酸蓄電池"},                {startColumnName:"csb_swt_cnt",numberOfColumns:6,titleText:"開關電源系統"},              {startColumnName:"csb_ups_cnt",numberOfColumns:6,titleText:"UPS系統"},                 {startColumnName:"csb_airc_cnt",numberOfColumns:6,titleText:"風冷精密空調"}
             ]
        });
        
        $("#"+gridType).jqGrid('setFrozenColumns');//滑動時此列凍結設置
        
        $("#"+gridType).navGrid("#"+gridType+"Pager", {//過濾
            search : true, // show search button on the toolbar
            add : false,
            edit : false,
            del : false,
            refresh : false
            },{}, // edit options
            {}, // add options
            {}, // delete options
            {
                multipleSearch : true,
                closeAfterSearch : true,
                closeOnEscape : true,
                searchOnEnter : true,
                Find : "查找"
            });
    }
    return {
        initAllGrid : initAllGrid,
        initTab:initTab
    };
})
View Code

 

define([], function() {
    
    function initTab(){
        initAllGrid();
        $('i[name="reportSearch"]').live("click",function(){  //過濾
            $("#search_con_grid_div_grid").click();
        });
    }
    //初始化全部grid
    function initAllGrid(){
        var colModel = [{label:'省(區、市)',name:'provice',index:'provice', width:90,align:"center",frozen:true,
                            cellattr: function(rowId, tv, rawObject, cm, rdata) {
                                  //合併單元格
                                 return 'id=\'provice' + rowId + "\'";
                            }
                },{label:'地市(鎮、區)',name:'area_name',index:'area_name', width:90, align:"center",frozen:true,
                    cellattr: function(rowId, tv, rawObject, cm, rdata) {
                          //合併單元格
                         return 'id=\'area_name' + rowId + "\'";
                    }
                },{label:'月份',name:'time_id',index:'time_id', width:80, align:"center"
                },//核心機樓
                {label:'核心機樓數量',name:'csb_cnt',index:'csb_cnt', width:90, align:"center"
                },{label:'歸入監控的數量',name:'csb_monit_cnt',index:'csb_monit_cnt', width:100, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t1',index:'t1', width:130, align:"center"
                },//傳輸匯聚節點機房
                {label:'傳輸匯聚節點機房數量',name:'tnsr_cnt',index:'tnsr_cnt', width:140,align:"center"
                },{label:'歸入監控的數量',name:'tnsr_monit_cnt',index:'tnsr_monit_cnt', width:100, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t2',index:'t2', width:130, align:"center"
                },//固定油機-核心機樓
                {label:'固定油機數量(臺)',name:'csb_foe_cnt',index:'csb_foe_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'csb_foe_monit_cnt',index:'csb_foe_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t3',index:'t3', width:130, align:"center"
                },//固定油機-傳輸匯聚機房
                {label:'固定油機數量(臺)',name:'tnsr_foe_cnt',index:'tnsr_foe_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'tnsr_foe_monit_cnt',index:'tnsr_foe_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t4',index:'t4', width:130, align:"center"
                },//變壓器-核心機樓
                {label:'變壓器數量(臺)',name:'csb_tf_cnt',index:'csb_tf_cnt', width:105, align:"center"
                },{label:'歸入監控的數量(臺)',name:'csb_tf_monit_cnt',index:'csb_tf_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t5',index:'t5', width:130, align:"center"
                },//變壓器-傳輸匯聚機房
                {label:'變壓器數量(臺)',name:'tnsr_tf_cnt',index:'tnsr_tf_cnt', width:105, align:"center"
                },{label:'歸入監控的數量(臺)',name:'tnsr_tf_monit_cnt',index:'tnsr_tf_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t6',index:'t6', width:130, align:"center"
                },//鉛酸蓄電池-核心機樓
                {label:'蓄電池數量(組)',name:'csb_bat_cnt',index:'csb_bat_cnt', width:105, align:"center"
                },{label:'歸入監控的數量(組)',name:'csb_bat_monit_cnt',index:'csb_bat_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t7',index:'t7', width:130, align:"center"
                },//鉛酸蓄電池-傳輸匯聚機房
                {label:'蓄電池數量(組)',name:'tnsr_bat_cnt',index:'tnsr_bat_cnt', width:105, align:"center"
                },{label:'歸入監控的數量(組)',name:'tnsr_bat_monit_cnt',index:'tnsr_bat_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t8',index:'t8', width:130, align:"center"
                },//開關電源系統-核心機樓
                {label:'開關電源系統數量(套)',name:'csb_swt_cnt',index:'csb_swt_cnt', width:150, align:"center"
                },{label:'歸入監控的數量(套)',name:'csb_swt_monit_cnt',index:'csb_swt_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t9',index:'t9', width:130, align:"center"
                },//開關電源系統-傳輸匯聚機房
                {label:'開關電源系統數量(套)',name:'tnsr_swt_cnt',index:'tnsr_swt_cnt', width:150, align:"center"
                },{label:'歸入監控的數量(套)',name:'tnsr_swt_monit_cnt',index:'tnsr_swt_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t10',index:'t10', width:130, align:"center"
                },//UPS系統-核心機樓
                {label:'UPS單機數量(套)',name:'csb_ups_cnt',index:'csb_ups_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(套)',name:'csb_ups_monit_cnt',index:'csb_ups_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t11',index:'t11', width:130, align:"center"
                },//UPS系統-傳輸匯聚機房
                {label:'UPS單機數量(套)',name:'tnsr_ups_cnt',index:'tnsr_ups_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(套)',name:'tnsr_ups_monit_cnt',index:'tnsr_ups_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t12',index:'t12', width:130, align:"center"
                },//風冷精密空調-核心機樓
                {label:'風冷空調數量(臺)',name:'csb_airc_cnt',index:'csb_airc_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'csb_airc_monit_cnt',index:'csb_airc_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t13',index:'t13', width:130, align:"center"
                },//風冷精密空調-傳輸匯聚機房
                {label:'風冷空調數量(臺)',name:'tnsr_airc_cnt',index:'tnsr_airc_cnt', width:120, align:"center"
                },{label:'歸入監控的數量(臺)',name:'tnsr_airc_monit_cnt',index:'tnsr_airc_monit_cnt', width:130, align:"center"
                },{label:'監控覆蓋率(百分比)',name:'t14',index:'t14', width:130, align:"center"
                }];
        _initGrid('con_grid_div_grid',colModel,470,15);
    }
    //初始化grid的方法
    function _initGrid(gridType,colModel,height,rownum){//
        var me = this;
        $("#"+gridType).jqGrid({
            height: height,
            rowNum : rownum,
            scrollOffset :0,
            datatype: "local",
            colModel:colModel,
            autowidth : false,
            shrinkToFit : false,
            autoScroll: true,
            pager: "#"+gridType+"Pager",
            gridComplete: function() {
                //②在gridComplete調用合併方法
                var gridName = gridType;
                Merger(gridName, 'provice');
                Merger(gridName, 'area_name');
            }
        });
        
         //公共調用方法
        function Merger(gridName, CellName) {
             //獲得顯示到界面的id集合
            var mya = $("#" + gridName + "").getDataIDs();
            //當前顯示多少條
            var length = mya.length;
            for (var i = 0; i < length; i++) {
                 //從上到下獲取一條信息
                 var before = $("#" + gridName + "").jqGrid('getRowData', mya[i]);
                 //定義合併行數
                 var rowSpanTaxCount = 1;
                 for (j = i + 1; j <= length; j++) {
                    //和上邊的信息對比 若是值同樣就合併行數+1 而後設置rowspan 讓當前單元格隱藏
                     var end = $("#" + gridName + "").jqGrid('getRowData', mya[j]);
                     if (before[CellName] == end[CellName]) {
                         rowSpanTaxCount++;
                         $("#" + gridName + "").setCell(mya[j], CellName, '', { display: 'none' });
                     } else {
                         rowSpanTaxCount = 1;
                         break;
                     }
                     $("#" + CellName + "" + mya[i] + "").attr("rowspan", rowSpanTaxCount);
                 }
            }
        }
        
        $("#"+gridType).setComplexGroupHeaders({
             useColSpanStyle: true, 
             groupHeaders:[//二級表頭
                 {startColumnName:"csb_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_cnt",numberOfColumns:3,titleText:"傳輸匯聚節點機房"},
                 {startColumnName:"csb_foe_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_foe_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"},
                 {startColumnName:"csb_tf_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_tf_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"},
                 {startColumnName:"csb_bat_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_bat_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"},
                 {startColumnName:"csb_ups_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_ups_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"},
                 {startColumnName:"csb_airc_cnt",numberOfColumns:3,titleText:"核心機樓"},
                 {startColumnName:"tnsr_airc_cnt",numberOfColumns:3,titleText:"傳輸匯聚機房"}
             ],
             complexGroupHeaders:[//三級表頭,和二級表頭用法同樣
                 {startColumnName:"csb_foe_cnt",numberOfColumns:6,titleText:"固定油機"},
                 {startColumnName:"csb_tf_cnt",numberOfColumns:6,titleText:"變壓器"},
                 {startColumnName:"csb_bat_cnt",numberOfColumns:6,titleText:"鉛酸蓄電池"},
                 {startColumnName:"csb_swt_cnt",numberOfColumns:6,titleText:"開關電源系統"},
                 {startColumnName:"csb_ups_cnt",numberOfColumns:6,titleText:"UPS系統"},
                 {startColumnName:"csb_airc_cnt",numberOfColumns:6,titleText:"風冷精密空調"}
             ]
        });
        
        $("#"+gridType).jqGrid('setFrozenColumns');//滑動時此列凍結設置
        
        $("#"+gridType).navGrid("#"+gridType+"Pager", {//過濾
            search : true, // show search button on the toolbar
            add : false,
            edit : false,
            del : false,
            refresh : false
            },{}, // edit options
            {}, // add options
            {}, // delete options
            {
                multipleSearch : true,
                closeAfterSearch : true,
                closeOnEscape : true,
                searchOnEnter : true,
                Find : "查找"
            });
    }
    return {
        initAllGrid : initAllGrid,
        initTab:initTab
   
相關文章
相關標籤/搜索