s.webbandit
s.webbandit

Reputation: 17000

How to implement listeners for selectionModel within controller in ExtJS 4.1 MVC

I have a grid with checkboxmodel selection model applied. Is there a way to put listeners on it within controllers control() method?

As far as DOCS say refs property is used to reference to Components only. SelectionModel is not a Component.

Upvotes: 1

Views: 1860

Answers (1)

sra
sra

Reputation: 23983

Simply register your listeners to the grid that contains this model using the supplied control() method of your controller. As far as I know all events from the checkboxmodel are bubbled up to grid. At least the selectionchange event works cause I use this one by myself along with a checkbox model.

'grid': {select: this.onSelect, selectionchange: this.onSelectionChange}

I don't recommend to use refs at all for such a case.

Edit:

As you might see in the API the checkboxes checkboxmodel are not of the type Ext.form.field.Checkbox. For that reason there is not single event from the checkbox that you may have in mind.

To force a selection by using the checkbox use

checkOnly: true

this will force a selection only by clicking the combo

Upvotes: 1

Related Questions