How to get a record from the store by selecting a row in the grid?

in extjs 3 I use:

  if (Model1.getSelectionModel (). getSelections (). length == 1) {
     record = Model1.store.getAt (Model1.getStore (). indexOf (Model1.getSelectionModel (). getSelected ()))
  }
but in extjs4 it doesn't work ...
+4
source share
1 answer

In ExtJS4 no method getSelections() . You need to use getSelection() .

In previous versions, you had:

  • getSelection () → Used to get the first selected record.
  • getSelections () → Used for selected records.

In ExtJS4, you only have getSelection() , which returns an array of the currently selected records. Therefore, you need to change the if statement. This should solve your problem.

Note: Use the getStore() method to access the store, not using the store property name.

+8
source

All Articles