Skip to content

Instantly share code, notes, and snippets.

@enovision
Created June 11, 2013 10:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enovision/5756018 to your computer and use it in GitHub Desktop.
Save enovision/5756018 to your computer and use it in GitHub Desktop.
Iterating a Ext JS 4 store. How to go through every record of Ext JS store
/*
In the functoin below you have to find your store
in your own object. If the function below is in a grid class
you can use it as it is put here
I like to keep things clear, therefor I address every object
in a seperate field for clarity.
*/
function IterateThisStore() {
var me = this;
// get the store you want to iterate
var store = me.getStore();
// selection model
var sm = store.getSelectionModel();
// all records with getRange()
var records = me.getStore().getRange();
// iteration of the store
Ext.each(records, function(item, idx) {
// item.get to access a field in the record
if (item.get('has_link') === true) {
sm.select(item.index, true);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment