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?
4 Answers
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);
}
1 Comment
Evan Trimboli
That's a poor way to do it. See below.
How do you get the rows from the grid?
var rows = grid.getStore().getRange();
rows will be an Array of Record objects.
2 Comments
user367134
can i get example of "Record objects" ?
Robby Pond
A record is the data behind a row in the grid.