我需要在extjs grid
面板
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";
}
}
答案 0 :(得分:3)
使用columnhide侦听器:
columnhide: function(ct, column, eOpts) {
alert(column.getIndex());
},
或者,您可以遍历网格列并检查每列上的isHidden()属性:
Ext.each(grid.columns, function(column, index) {
if (column.isHidden()) {
alert('column at index ' + index + ' is hidden');
}
});
我在此设置了一个测试用例:http://jsfiddle.net/cCEh2/