Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to loop through the extjs grid object to get its elements and values

Tags:

grid

extjs

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?

like image 852
user367134 Avatar asked Jun 30 '10 12:06

user367134


2 Answers

If you want to get a particular field from each record:

var data = [];
store.each(function(rec){
    data.push(rec.get('field'));
});
like image 149
Evan Trimboli Avatar answered Oct 24 '22 10:10

Evan Trimboli


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);
}
like image 5
user367134 Avatar answered Oct 24 '22 09:10

user367134