Sharon Watinsan
Sharon Watinsan

Reputation: 9850

Filter records in a grid - using code

I have a grid which has 50 records. As soon as the grid gets populated i would want it to filter records on load to a particular form. For example; as soon as it loads it should display all students with the age of 10.

This has to be coded; i went through the grid-filter-local.js example and it shows how to clear the filter options but not to set the filter options by code. How can i do this ?

Upvotes: 0

Views: 792

Answers (1)

sha
sha

Reputation: 17860

Something like that?

var st = Ext.getStore('MyStore');

st.clearFilter();
st.on('load', function() {
   st.filter({
       filterFn: function(rec) { return rec.get('age') > 10; }
   });
}, this, { single: true });

Upvotes: 1

Related Questions