Search code examples
extjs4

How to get "items" array of Ext.grid.column.Column


I have a GridPanel whose columns have 'items' property set to an Ext.form.field.Trigger. I use the trigger field to work like a filter. I have a button in toolbar which should show/hide the Triggers. For this I need to get the 'items' configuration of the Column. Any ideas?

Code

{
xtype: 'gridcolumn',
dataIndex: 'title',                                     
minWidth:100,
flex: 3,
text: 'Title',
layout: 'hbox',
items:[{
    xtype: 'trigger',
    autoSearch: false,
    anyMatch : true
}]

}


Solution

  • I have found a solution for it. Although not the best but gets the job done

    Code

    var columns = grid.columns;
    if(grid.columns!=undefined){
         for(var i =1; i<columns.length; i++){
            var column = columns[i];
            if(column!=undefined){
                var colItems = column.items;                                                                            
                if(colItems!=undefined){
                    var colItem = colItems.items[0];                                    
                    if(colItem!=undefined){colItem.setVisible(true);}                                               
                }           
            }                                       
        }                                       
    }