PDA

View Full Version : Buffered store



mixo
20 Feb 2013, 12:00 AM
hello again guys!

I have some kind of feature request for buffered store implementation.
In our webApp I realized grid view with buffered store and I have some issues.

I would like to have ability to pass some personal data between clien and server while querying data pages. It's needed for auth purpose and for some server signalization in our case and anyway can be helpful for using by other developers.

Buffered store query data pages in some specific way. It have two kind of query: query data for display and query data for buffering. In second case all my personal data is not sending to the server and i need manually attach it for each request. I guess it would be nice if you can define a simple way to adding some user params to request for buffered store another desire is make store request(over proxy and reader) looking identically to simple Ext.Ajax.request behavior with success and failure cb. Of course its imho but i hope it would be useful!

Thank you!

vadimv
20 Feb 2013, 12:23 AM
Why not just to check documentation http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Store-cfg-buffered ....would be much faster then asking in forum.

A simple example:


Ext.define('YourApp.store.YourStore',{
extend: 'Ext.data.Store',
model: 'YourApp.model.YourModel',
pageSize: 100,
autoLoad: false,
buffered: true,
purgePageCount: 2,
proxy: {
type: 'ajax',
url: your_url,
reader: {
type: 'json',
root: 'data',
totalProperty: 'total'
},
extraParams: {
// add your query params
}
}
});
// in case you want programatically to setup the query params:
store.getProxy().extraParams = {}

// if there are already some query params in extraParams, then just use Ext.apply.
Ext.apply(store.getProxy().extraParams,{
// additional parameters
})

note that this example works for ExtJS 4.1.1, haven't tested for 4.1.3. For 4.2 might look different, probably, as there was some changes on the grid and the buffered store if I'm not wrong

mixo
20 Feb 2013, 8:13 PM
Thank you vadimv!

It's do the trick.