Hello!
I can not figure out the search in the Store ( ExtJS 4.1 ) ... There is such a Store (the set of fields in the example is simplified).
(did by the example of Ext.data.writer.Writer Example ):
var store = Ext.create('Ext.data.Store', { autoLoad: true, autoSync: true, idProperty: 'id', remoteFilter: true, fields: [ { name: 'id', type: 'int' }, { name: 'date', type: 'date' }, { name: 'title', type: 'string' }, { name: 'alias', type: 'string' }, { name: 'text', type: 'string' } ], proxy: { type: 'ajax', api: { read: Const.PathDir + 'view/store.html', create: Const.PathDir + 'create/store.html', update: Const.PathDir + 'update/store.html', destroy: Const.PathDir + 'destroy/store.html' }, reader: { type: 'json', successProperty: 'success', root: 'd', messageProperty: 'message' }, writer: { type: 'json', writeAllFields: false, root: 'd' }, listeners: { exception: function(proxy, response, operation){ Ext.MessageBox.show({ title: 'REMOTE EXCEPTION', msg: operation.getError(), icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); } } } });
From this Stote need only one item with the specified ID. I am looking for
activeRecord = store.findRecord('id', itemId);
The server gives the data in chunks by default - that is, 25 items each. And the search is performed only in the received portion. There is no reason to load all elements - the data volume is 5 megabytes and will only grow. I tried to use the filter
store.filter([{property: 'id' , value: itemId}]); activeRecord = store.findRecord('id', itemId);
But since the data is loaded asynchronously, the search is performed on non-filtered data.
So I would like to ask:
Is it possible to perform a search on the server side or somehow determine the moment of loading data from the server?