PDA

View Full Version : combobox filter Help



jvfiel
17 Nov 2011, 7:01 PM
Hello guys im new here, and i would like to ask about filtering records.
how can i filter my store here in ext js 3x?

for example given the store below with its proxy,reader and writer:

var proxy = new Ext.data.HttpProxy({
url: '/api/terminal'
});




var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
messageProperty: 'message',
root: 'data'
}, [
{name: 'id'},
{name: 'name', allowBlank: false},
{name: 'status', allowBlank: false},
{name: 'logintime', type: 'date'}
]);




var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true
});




var store = new Ext.data.Store({
id: 'user',
restful: true,
proxy: proxy,
reader: reader,
writer: writer,
listeners: {
write: function(store, action, result, response, rs) {
App.setAlert(response.success, response.message);
}
}
});

my plan is that i want to filter records with status that is equal to INACTIVE (status = INACTIVE)
and show them in my combobox

mitchellsimoens
18 Nov 2011, 1:57 PM
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.Store-method-filter

jvfiel
18 Nov 2011, 6:30 PM
thanks anyway got them working all ready :)