PDA

View Full Version : PlugIn to select a row with CellSelection Model



gelleneu
16 Apr 2008, 6:57 AM
There are many fine PlugIns for RowExpanding, Checkboxes, Line Numbers and so on.
Is there a plugin to select a whole row, when the SelectionModel is configured as CellSelectionModel?

Steffen Hiller
23 May 2008, 12:38 PM
There are many fine PlugIns for RowExpanding, Checkboxes, Line Numbers and so on.
Is there a plugin to select a whole row, when the SelectionModel is configured as CellSelectionModel?

gelleneu, did you find a good solution? I'm looking for the same.

Thanks,
Steffen

dajianshi
26 May 2008, 1:29 AM
fortunately, the CSSs for cell and row are not the same!
so this method will do work!


Ext.override(Ext.grid.GridView,{
// private
onCellSelect : function(row, col){
this.onRowSelect(row);
var cell = this.getCell(row, col);
if(cell){
this.fly(cell).addClass("x-grid3-cell-selected");
}
},

// private
onCellDeselect : function(row, col){
this.onRowDeselect(row);
var cell = this.getCell(row, col);
if(cell){
this.fly(cell).removeClass("x-grid3-cell-selected");
}
}
});

Steffen Hiller
26 May 2008, 6:15 AM
Hey dajianshi,

thanks for your reply!
Your code really seems to do what I was originally was asking for.
This weekend, I took it a step further, though. I wrote my own RowWithCellSelectionModel class :-) It's inheriting the RowSelectionModel and adds the CellSelectionModel behaviour with some specials: You can use the normal RowSelection features, such as selecting multiple row and using arrow keys to move/change the selection. After you doubleclicking a cell, the CellSelectionModel is "activated". You can navigate with the arrow keys through the cells.
Works great. :-)
As soon as I got a few more minutes, I'll release that as an extension ...

Regards,
Steffen

dajianshi
26 May 2008, 7:14 PM
I hope see it soon

Steffen Hiller
23 Jun 2008, 5:31 AM
For the folks that contacted me and are interested, I published my Ext.ux.RowWithCellSelectionModel extension a couple of days ago at http://github.com/steffen/ext.ux.rowwithcellselectionmodel/

Regards,
Steffen

sandeepan
10 Feb 2009, 2:30 AM
i found the ugly was a simple and interesting way.
Thanks :)