PDA

View Full Version : Show column without rendering it



mad_ady
23 Mar 2010, 1:27 AM
Hello,
I'm trying to optimize some code that has to iterate through all the columns in my grid and must show the columns which are hidden. The code looks like this:



//show all columns (slow)
for (var i=0; i< this.columnModel.config.length; i++){
if(this.columnModel.config[i].hidden){
this.columnModel.setHidden(i,false);
}
}
The code works, but it's rather slow (for a grid with ~30 hidden columns and 25 rows I sometimes get a warning from Firefox that the script is unresponsive). I guess the setHidden function also triggers rendering for the columnModel.

I'd like to "unhide" all the colums and then call rendering manually. I guess I could reverse-engineer what setHidden does, but I wanted to ask first if there is a documented way to do this, without risking to break the code in relation to future versions of Extjs...

Thanks,
Adrian

sis9
24 Mar 2010, 3:14 AM
check aconran's post here
http://www.extjs.com/forum/showthread.php?p=162056

a great plugin could be find here
http://tdg-i.com/js/examples/ext/dataGrid/colview/
forum here
http://www.extjs.com/forum/showthread.php?t=28832

if my post will be approved, you will find an optimized code as well
http://www.extjs.com/forum/showthread.php?t=28832&page=3

sis9
24 Mar 2010, 10:23 AM
check aconran's post here
http://www.extjs.com/forum/showthread.php?p=162056

or TDGi GridView override http://tdg-i.com/js/examples/ext/dataGrid/colview/
I updated his code and tested with extjs 3.1.0
http://www.extjs.com/forum/showthread.php?p=450498#post450498

mad_ady
25 Mar 2010, 2:16 AM
Thanks!

columnModel.suspendEvents() and columnModel.resumeEvents() did the trick!

Maybe this should also be in the FAQ...