In my grid I want to set 3 buttons allowing the user to choose the cols to view
So I wrote this function; it's fast on chrome and safari, but it takes a lot of time on Firefox.
Where is the problem? Is there another way to do this?
function showHideCols(dcols){
thisGrid = Ext.getCmp('myGrid')
thisColModel = thisGrid.getColumnModel()
var hiddenCols = thisColModel.getColumnsBy(function(c){
if(c.hidden==true) return true;
});
var majCols = thisColModel.getColumnsBy(function(c){
if(c.id>17) return true;
});
var editCols = thisColModel.getColumnsBy(function(c){
if(c.id<18) return true;
});
switch(dcols){
case 'maj' :
Ext.each(majCols,function(f){
thisColModel.setHidden(f.id,false)
})
Ext.each(editCols,function(f){
thisColModel.setHidden(f.id,true)
})
break;
case 'edit':
Ext.each(majCols,function(f){
thisColModel.setHidden(f.id,true)
})
Ext.each(editCols,function(f){
thisColModel.setHidden(f.id,false)
})
break;
case 'all' :
Ext.each(hiddenCols,function(f){
thisColModel.setHidden(f.id,false)
})
break;
}
}
I have 26 cols in the grid. first I show from 0 to 17 (editCols), second from 18 to 26 (majCols) and last show all