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?

    2 answers 2

    Use the load or loadRecords function to load only the records you need. Here is an example .

    • Thank you, this is really what you need ... Do not tell me how to shade the window? Let's say the variable modalWin is the window that needs to be shaded, and from the callback of the load function, remove the shading ... - ProGer
    • I have never used ExtJS at all, if that :) - Zhukov Roman
    • Well, thanks for that too :) - ProGer

    Everything is just store.filter () - it searches locally, that is, from the downloaded data, if you need to get from the server, you need to specify the baseParams from the store: {filter} and load it either store.reload ({lastParams: {filter}});

    Thank you, this is really what you need ... Do not tell me how to shade the window? Let's say the variable modalWin is the window that needs to be shaded, and from the callback of the load function, remove the shading ...

     modalWin.getEl().mask('Згрузка'); убрать modalWin.getEl().unmask();