Skip to content

Instantly share code, notes, and snippets.

@nelsonpecora
Created February 8, 2012 16:39
Show Gist options
  • Select an option

  • Save nelsonpecora/1770915 to your computer and use it in GitHub Desktop.

Select an option

Save nelsonpecora/1770915 to your computer and use it in GitHub Desktop.
Filtering an n-columned ExtJS grid from a searchbox
onSearchFieldChange: function (obj, value) {
var store, searchRegExp;
store = Ext.getStore();
store.clearFilter();
searchRegExp = new RegExp(value, 'i');
store.filterBy(function (item) {
var i = 0,
l = Object.keys(item.data).length;
for (; i < l; i++) {
if (searchRegExp.test(item.get(Object.keys(item.data)[i]))) {
return true;
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment