PDA

View Full Version : Adding and removing locked columns



nicora
13 Sep 2007, 3:36 PM
I've spent a good amount of time today trying to find an example of how to lock columns after the grid has rendered. I was able to unlock a column, but locking did not work. This is my grid set up:



var grid = new Ext.grid.Grid('reqGrid', {
ds: ds,
cm: cm,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
loadMask: true,
autoHeight: false,
autoWidth: false,
enableColLock:true,
enableCtxMenu: false,
enableRowHeightSync: true
});


if in the column model i set the first column locked and run this following code, it works



grid.getColumnModel().setLocked(0, 0);


but then if I fire the following code to lock it again, nothing happens



grid.getColumnModel().setLocked(0, 1);


What am I missing? Are there any examples of how to do this, I couldn't even find setLocked in the documentation, but I may have just missed it.

Thanks in advance for the help!

nicora
13 Sep 2007, 4:42 PM
nm, i found the problem

evant
13 Sep 2007, 5:02 PM
Care to share your solution? It would be helpful if anyone has the problem in future.

nicora
13 Sep 2007, 6:59 PM
basically, I registerd a refresh method for the coulumnlockchange event and it started to work.



function setEvents(){
grid.getColumnModel().on("columnlockchange", refresh);
}
function refresh(){
grid.getView().refresh();
}

hendricd
13 Sep 2007, 7:32 PM
They were removed from Ext 2.0. See here (http://extjs.com/forum/showthread.php?t=12866).

nicora
13 Sep 2007, 7:55 PM
Client requirement, if we lose column locking in the future I will have to put it back in anyway.

nicora
13 Sep 2007, 8:18 PM
Just wanted to throw this out there, but why would Ext remove column locking? It's typically bad business to take features away, could I suggest leaving us the option to include it or not?

tryanDLS
14 Sep 2007, 8:18 AM
Just wanted to throw this out there, but why would Ext remove column locking? It's typically bad business to take features away, could I suggest leaving us the option to include it or not?

There's another thread discussing this (maybe the grid3 preview thread). Basically I think it came down to a question of performance. That being said, maybe Jack/Brian can comment on the possibility of the current functionality being maintained in a compatibility section.

nvbaalamurugan
14 Sep 2007, 3:38 PM
Column locking is one of the main reasons we decided to consider Ext. Would it be possible to get this feature in 2.0?