PDA

View Full Version : Paging toolbar: call store.load() instead of the auto firing of paging store.load()



radtad
18 Apr 2012, 1:53 PM
I'm trying to add a custom store.load() before the paging load event is fired. I can put the logic in 'beforechange' and return false, but then the page information doesn't get updated. This actually used to work in 4.0.7. In 4.1 RC3 this doesn't seem to work anymore.

I can't get this to work with the 'beforeload' listener of the store in MVC as logic is done in the controller. Anyway to just suppress the paging 'load' event from happening and having the pagingtoolbar update its page number and other information?

Also, the parameters and content-type are JSON data so the param structure must be in JSON format which makes things way more difficult.



Ext.define('RH.store.mrln.PagedThumbnails', {
extend: 'Ext.data.Store',
model: 'RH.model.mrln.Thumbnails',
remoteSort: false,
pageSize: 25,
proxy: {
actionMethods: { read: 'POST'},
headers: {'Content-Type': 'application/json; charset=utf-8' },
type: 'ajax',
noCache: false,
url: 'data.json',
reader: {
type: 'json',
root: 'contents',
totalProperty: 'count',
getData: function(data){
return Ext.isArray(data) ? data[0] : data;
}
}
}
});




'thumbnails > pagingtoolbar': {
beforechange: function(ptb,page,opts) {
// this does the store.load() event with some logic.
this.application.fireEvent('getcontents',resourceView,nodeId,page,ptb.store.pageSize);
ptb.page = page; // obviously doesn't work
return false; // works but doesn't update the page number
}
}


store.load() JSON parameters


{"user":"tad","agent":"Web_mrln","system":"mrln","method":"getPagedContents","types":["rh.pb.UIntPB","rh.pb.BoolPB","rh.pb.UIntPB","rh.pb.UIntPB"],"params":[{"arg":["{value: 189531}","{value: true}","{value: 26}","{value: 25}"]}]}

radtad
18 Apr 2012, 1:55 PM
I can include operation.params = ... but I need to fire an application event on callback through MVC and that would kind of defeat the purpose if I wanted to use this store in a different app in a different way.