PDA

View Full Version : How do you subclassAbstractStoreSelectionModel?



21 Oct 2011, 9:57 AM
could some one kindly give me an example of how to subclass AbstractStoreSelectionModel? The selection model in my gridpanel totally does not work, but I've read from the documentation that "DataBound UI widgets such as GridPanel, TreePanel, and ListView should subclass AbstractStoreSelectionModel and provide a way to binding to the component. The abstract methods onSelectChange and onLastFocusChanged should be implemented in these subclasses to update the UI widget."

Many thanks in advance

DS

skirtle
21 Oct 2011, 11:05 AM
Which framework is this for? I don't see a class called AbstractStoreSelectionModel in ExtJS 4.

21 Oct 2011, 12:00 PM
I found it at this link: http://dwim.hu/static/hdws/libraries/ext-4.0-beta2/docs/api/Ext.selection.Model.html# . I just noticed this is for 4.0-beta2. However, almost the same text is in my 4.0.3 extjs4 documentation: @ Ext.Selection.Model :
"Tracks what records are currently selected in a databound widget.

This is an abstract class and is not meant to be directly used.
DataBound UI widgets such as GridPanel, TreePanel, and ListView should subclass AbstractStoreSelectionModel and provide a way to binding to the component.
The abstract methods onSelectChange and onLastFocusChanged should be implemented in these subclasses to update the UI widget."

21 Oct 2011, 12:04 PM
Why doesn't grid.getView(), grid.getSelectionModel(), etc. work in a gridpanel?

skirtle
21 Oct 2011, 12:28 PM
Please don't post unrelated questions in the same thread.

Unless you're trying to do something unusual you don't need to subclass Ext.model.Selection. Generally you'd just use one of the existing subclasses. See the Sub Classes link at the top of the docs:

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.selection.Model


Why doesn't grid.getView(), grid.getSelectionModel(), etc. work in a gridpanel?

They work fine, there must be a mistake in your code. It would be easier to help you if you posted a small code example of your problem. Make sure any code you post is surrounded with CODE tags (# button in the editor toolbar).