-
19 Apr 2011 2:04 PM #1
Ext.ux.grid.NullSelectionModel
Ext.ux.grid.NullSelectionModel
Hey all. Please read here for some background info on why.
A SelectionModel that selects nothing. Use the NullSelectionModel in cases
where the behavior of a selection model is not desired. Please take notice
that the GridPanel control defaults to RowSelectionModel when a selection
model is not specified. This means specifying null for a selection model
will not achieve the desired result.
Code:Ext.ns('Ext.ux.grid'); /** * @class Ext.ux.grid.NullSelectionModel * @extends Ext.grid.AbstractSelectionModel * A SelectionModel that selects nothing. Use the NullSelectionModel in cases * where the behavior of a selection model is not desired. Please take notice * that the GridPanel control defaults to RowSelectionModel when a selection * model is not specified. This means specifying null for a selection model * will not achieve the desired result. * @constructor * @param {Object} config */ Ext.ux.grid.NullSelectionModel = Ext.extend(Ext.grid.AbstractSelectionModel, { constructor: function(config) { Ext.apply(this, config); Ext.ux.grid.NullSelectionModel.superclass.constructor.call(this); }, // private onEditorKey: function(field, e) { /* Does nothing. Declared only because the GridPanel control calls this function. */ }, // private initEvents: function() { /* Does nothing. Declared only because the GridPanel control calls this function. */ } });
-
19 Apr 2011 4:33 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
or...
Code:grid.getSelectionModel.on('beforerowselect', function() { return false; });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Apr 2011 8:27 AM #3
And I did try that well before implementing this NullSelectionModel bit. It did not yield the results I was expecting. Please give attention to this post for some background info on the problem.
Or to re-iterate in different words... I am using a cell renderer to output dropdown controls (select element) into a cell. And whenever the select element received focus, the RowSelectionModel would cause the select element to lose focus.
The end user's experience would be this:- user locates a dropdown box on the screen
- user clicks the down arrow button
- the dropdown list appears on the screen followed by disappearing instantly
- the row's background color changes to indicate a selected row
- since at this time the list is no longer visible - user re-clicks the down arrow button
- the dropdown list appears on the screen and stays visible this time
- user selects an item from the dropdown list
- user locates a dropdown box on anther row
Repeat the these steps for 20 or so rows and this becomea an annoying user experience. This user experience only happened in IE.
I tried the "beforerowselect" event, which did prevent the row from being selected, however, the user experience was the same otherwise.
-
20 Apr 2011 8:32 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 434
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
20 Apr 2011 8:42 AM #5
I would also like to point out that even if you do hook into the RowSelectionModel's "beforerowselect" event in order to prevent a row from being selected, there is still some other funky focus behavior that the RowSelectionModel performs.
So if this funky focus behavior poses itself as a problem in your situation then you naturally need to find a solution.


Reply With Quote
