简体   繁体   English

获取extjs网格面板中隐藏列的列索引

[英]get column index of hide column in extjs grid panel

I need to get column index of hide column in extjs grid panel 我需要在extjs grid面板中获取hide列的列索引

columnhide: function() {
            var cell = this.getEl().query('.x-grid-cell-inner');

            for(var i = 0; i < cell.length; i++) {
            if (i%2 != 0){  // Instead of this i, want to change the style to none for the  hide column, so i need to get the column index of hide column in grid panel
                    cell[i].style.display= "none";
                }
            }

Using the columnhide listener: 使用columnhide监听器:

columnhide: function(ct, column, eOpts) {
    alert(column.getIndex());
},

Alternatively, you could loop through the grid columns and check the isHidden() property on each column: 或者,您可以遍历网格列并检查每列上的isHidden()属性:

Ext.each(grid.columns, function(column, index) {
   if (column.isHidden()) {
       alert('column at index ' + index + ' is hidden');
   }
});

I have a test case set up here: http://jsfiddle.net/cCEh2/ 我在这里设置了一个测试用例: http//jsfiddle.net/cCEh2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM