PDA

View Full Version : [FIXED-620][3.1.1] Grid LockingColumnModel event bug - not firing on all columns



mcouillard
22 Feb 2010, 9:12 AM
The event "columnlockchange" doesn't fire on every column within the column model. Example, you change the lock state of the first column - the event fires. But if you change the lock state of the second column... the event never fires.

Example: use the locking-grid.html example file from /examples/grid/.

Change the new colModel so it's set to a global, like Ext.testCM:

colModel: Ext.testCM = new Ext.ux.grid.LockingColumnModel([

Remove the locked:true from the first column in the JS file. We don't want any default locked columns.

Within Firebug (or the JS file) give the event a function:

Ext.testCM.on('columnlockchange',function(){ console.debug('col change',arguments); })Notice that on change of any column's lock state (click dropdown arrow, choose Lock) the event you've added doesn't always fire.

Tested in FF 3.6, IE7 and IE8.

mcouillard
21 Apr 2010, 11:46 AM
Just tested in 3.2.0 and it fails, too. Make the above changes and then try to Lock any column but the first. No columnlockchange event fires. Only Locking the first column makes the event fire, and after that all other columns fire the event, too.

mcouillard
21 Apr 2010, 12:14 PM
Workaround found. The following function within LockingGridView can be changed so columns other than the first correctly call the setLocked function.

I don't understand the original logic. setLocked seems like it should certainly be called with a 3rd parameter of false in this scenario.



handleHdMenuClick : function(item){
...
case 'lock':
if(cm.getColumnCount(true) <= llen + 1){
this.onDenyColumnLock();
return;
}
cm.setLocked(index, true); //moved here from below
if(llen != index){
//cm.setLocked(index, true, true);
cm.moveColumn(index, llen);
this.grid.fireEvent('columnmove', index, llen);
}else{
//cm.setLocked(index, true);
}
...

Jamie Avins
26 Apr 2010, 10:24 AM
[type]: fix
[module]: LockingGridView
[id]: #620
[desc]: Fixes #620. lock event no longer suppressed on columns other than the last column.

mcouillard
31 Mar 2011, 9:25 AM
A month after my initial posts I upgraded this script for 3.2.1 and had to make the following changes:



handleHdMenuClick : function(item){
...
//cm.setLocked(index, true); //removed
if(llen != index){
cm.setLocked(index, true, true); //added
cm.moveColumn(index, llen);
this.grid.fireEvent('columnmove', index, llen);
} else {
cm.setLocked(index, true); //added
}
//[code to save state to server]
...