[ACCEPTED]-extjs show/hide column dynamically-extjs

Accepted answer
Score: 11

You can use the beforerender event to hide the column. The 9 event is called before the render function 8 is called to display your grid. The event 7 function take a param which is the grid 6 itself. From this grid object you can get 5 the column model of the grid and call setHidden method 4 to hide the appropriate column. From the 3 grid object you can also get the store attached 2 to the grid for your check.

Here is how the 1 code will be:

listeners: {
    'beforerender' : function(grid) {

        store = grid.getStore();
        if(your-condition) {
            cm = grid.getColumnModel();

Score: 5

You can check and hide when store loads:

    callback: function(){
        // access raw json data and check some columns to hide or not
        if(store.getProxy().getReader().rawData.myColumn.hide) {
        if(store.getProxy().getReader().rawData.myAnotherColumn.hide) {


More Related questions