Bdfy
Bdfy

Reputation: 24621

how to get record from store selecting row in 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's not work ...

Upvotes: 4

Views: 19639

Answers (1)

Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

There is no getSelections() method in ExtJS4. You need to use the getSelection().

In previous versions you had:

  1. getSelection() -> Used to get the first selected record.
  2. getSelections() -> Used to the selected records.

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

extra note: Use the getStore() method to access the store rather than using the property name store.

Upvotes: 8

Related Questions