0
votes

I have an extjs store associated with grid class. when I select a class, it gives ClassID of the record.

var ClassData = record.get('ClassID');
console.log(ClassData);

Based on this ClassID I am loading store of next grid:

var Grid = this.getSemGrid();
var Store = Grid.getStore();     // your grid's store    

//load store with records having selected class ID
var g = Store.load( {params : {ClassID: ClassData }});

Till here everything is fine.

Once the store is loaded, I am getting all loaded records (Error Area)

var selected = g.getRange();  // getRange = select all records

Then pushing all the values of one field of all records in an array

var Excerpt = []; // start with empty array
Ext.each(selected, function(item) {
    // add the fields that you want to include
    var Obj = {
        third_field: item.get('ExamName')
    };
    Excerpt.push(Obj); // push this to the array
}, this);
console.log(Excerpt);

Excerpt gives array of previously selected record not the current record.

I have also tried

Store.loadData([],false); 

to clear all the loaded data of store before loading it again.

1

1 Answers

0
votes

Got this working

var g = Store.load({ 
  params : {ClassID: ClassData }, 
  callback : function(records, operation, success){ 
    var Excerpt = []; // start with empty array 
    Ext.each(records, function(item) { 
      // add the fields that you want to include 
      var Obj = { 
        third_field: item.get('ExamName') 
      }; 
    Excerpt.push(Obj); // push this to the array 
    }, this); 
  } 
});