I have created a grid and want to access it when I click on save button in a page. How can I loop the grid object to get its elements and its values?
If you want to get a particular field from each record:
var data = [];
store.each(function(rec){
data.push(rec.get('field'));
});
Here is the answer to my question:
for (var i = 0; i < yourGrid.getStore().data.length; i++) {
var element = Ext.get(yourGrid.getView().getRow(i));
var record = yourGrid.getStore().getAt(i);
alert(record.data.ID);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With