Hello,
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 elemnts and its values ?
Hello,
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 elemnts and its values ?
How do you get the rows from the grid?
var rows = grid.getStore().getRange();
rows will be an Array of Record objects.
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); }
That's actually quite wrong.
If you want to get a particular field from each record:
var data = [];
store.each(function(rec){
data.push(rec.get('field'));
});