RynnHeldeD
RynnHeldeD

Reputation: 51

ExtJS 7 Modern : Retrieve grid selected rows

I have a grid with checkbox selection to allow multiple rows selection.

Ext.define("app.view.grid.MyGrid", {
  extend: "Ext.grid.Grid",
  xtype: "app.MyGrid",

  viewModel: "Grid",

  selectable: {
    rows: true,
    checkbox: true,
  },

But now, how can I get all the selected rows? If I use grid.getSelection(), it only shows the latest selected row. I saw many answers using grid.getSelectionModel().getSelection() but this works on Classic toolkit, I am using 7.4 Modern.

If I try, it gives me getSelectionModel() is not a function and this method is not available anymore : https://docs.sencha.com/extjs/7.4.0/modern/Ext.grid.Grid.html#event-select

Thank you

Upvotes: 2

Views: 547

Answers (1)

Peter Koltai
Peter Koltai

Reputation: 9829

Try grid.getSelections(), in modern toolkit it should return an array with the selected items.

Upvotes: 1

Related Questions