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
I d'say it does not depend on the number of columns, but on the number of rows in the grid.
Plus, column hiding/showing has always been slow in Firefox; acceptable for 1 column, but could be slow as hell for 26 columns and lot of rows !
Do you have firebug enabled ?
If yes, you could try profiling, by putting console.profile("show/hide cols"); before what you want to profile, and console.profileEnd(); after.
But firebug is itself slowing down Firefox + ExtJS.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论