user2353513
user2353513

Reputation: 189

hidden true in extjs need to have same functionality as that of hide column

I have overridden the hide column functionality of extjs which is working fine. When the column is given hidden:true, during first time page load my hide functionality is not working. When i do hide/show column, it is working. Need to have the same functionality enabled during page load too

columnhide: function() {
    var cell = this.getEl().query('.x-grid-cell-inner');
    var collen = grid.columns.length;
    var i = 1;
    for (var y = i; y < cell.length; y = y + collen) {
        for (var x = 0; x < cell.length; x++) {
            if (x == y) {
                cell[x].style.display= "none"; 
            }
        }
    }
} 

Upvotes: 1

Views: 1142

Answers (1)

rixo
rixo

Reputation: 25001

You're right, the columnhide event fires only when a column is hidden after it has been rendered.

The simplest way to make your current code work would be to call hide() on the column, instead of using the hidden option.

Replacing hidden: true with the following in the column config will do the trick:

    ,listeners: {
        // we want to catch the event only the first time it is fired
        single: true
        ,afterrender: function() {
            this.hide();
        }
    }

This code will add a listener to the column you want to hide, and after the column is rendered, it will call its hide() method. That will trigger your event, etc.

Upvotes: 2

Related Questions