TAGS :Viewed: 10 - Published at: a few seconds ago

[ How to get a selected object within other stuff? ]

I have a multiselect grid where I can get schools.getSelectionModel().getSelection();

there is an object called data, I want to get a field within the data; lets say school_name

How I'll do it?

I've tried


they did not work.

Answer 1

You have to use Ext.each to iterate over the array of records..

Ext.each(schools.getSelectionModel().getSelection(), function(record, index, allRecords) {

Answer 2



should give you a 'school_name' field from first row selected (which is also a first record in selection).

To iterate over all selected rows do:

var selectedSchools = schools.getSelectionModel().getSelection();
for (i in selectedSchools) {
  console.log(schools[i].get('school_name'));  //this will log school name to firebug console - you can do whatever you need