Created
June 11, 2013 10:52
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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