Friday, June 27, 2008

Ext.ux.RowWithCellSelectionModel

I recently published another Ext JS extension at http://github.com/steffen/ext.ux.rowwithcellselectionmodel/ I want to let you know about.

Ext.ux.RowWithCellSelectionModel

This Ext JS extension enables the user to activate the editor of an editable cell in an Ext.grid.EditorGridPanel through a double click, to navigate through the cells via the cursor keys and select one or multiple rows through the mouse or through the cursor keys, if no cell is currently selected.
In summary, this selection model is a combination of the two built-in selection models Ext.grid.RowSelectionModel and Ext.grid.CellSelectionModel.
I created it out of the need to be able to add, edit and delete records in an EditorGridPanel. To delete one or multiple records, the user needs to select one or multiple rows which is not possible when using the default Ext.grid.CellSelectionModel.


Installation

Either
git clone git://github.com/steffen/ext.ux.rowwithcellselectionmodel.git
or download the files from http://github.com/steffen/ext.ux.rowwithcellselectionmodel/tarball/master
and put them in a public accessible folder.
Include the RowWithCellSelectionModel.js file in the header of your html page after the Ext JS files.



Usage

new Ext.grid.EditorGridPanel({
ds: your_data_store,
cm: your_column_model,
sm: new Ext.ux.RowWithCellSelectionModel()
});


Alternatives

There exists another extension called Ext.ux.grid.RowAction by Jozef Sakalos, aka Saki, which enables you to add
icons with actions to grid rows. You can't delete multiple records at once, but it's worth a look. See http://rowactions.extjs.eu/ for more infos.

3 comments:

Anonymous said...

This is something that I was looking for. Though how do I get getSelectedCell() equivalent for your extension.

Basically I would want to get the selected rows, do the deletion on the server side and then delete the rows in the EditorGridPanel.

Thanks !

Steffen Hiller said...

Hey,

grid.getSelectionModel().selection for cell,
grid.getSelectionModel().selections for row(s).

There exists a getter method for selections which is getSelections(), maybe a getSelection() should be added by me sometime which conforms with the ext js standard. But accessing the properties directly should do it for now.

Regards,
Steffen

Songa said...

Hi Steffen,

Thanks for the great post, I am trying it out but since I am at a learning stage, I have to ask a stupid question, where do I put the usage javascript code and how do I implement the view?

Thanks!