I have discovered a viable solution that may not be the most elegant, but it gets the job done.
Upon examining the sencha code, I noticed that both the pagingtoolbar and store.indexOfTotal() were utilizing record.index
, which was causing issues in my scenario where it was set as if the first page was already loaded. This setting of record.index
occurs within the store.loadRecords
function:
loadRecords: function(records, options) {
// ...
//FIXME: this is not a good solution. Ed Spencer is totally responsible for this and should be forced to fix it immediately.
for (; i < length; i++) {
if (options.start !== undefined) {
records[i].index = options.start + i;
}
// ...
},
The "FIXME" comment was present in the code and is not an addition from me.
An ideal resolution would involve finding an event triggered after the response is received but before calling loadRecords, allowing for the override of options
within the handler. Unfortunately, such an event has not been found yet.
However, it is always possible to override loadRecords:
Ext.define('MyApp.store.MyStore', {
extend : 'Ext.data.Store',
// ...
loadRecords : function(records, options) {
if (this.proxy.reader.rawData.page) {
var page = this.proxy.reader.rawData.page;
// Adjusting for pagingtoolbar
this.currentPage = page;
// Ensuring proper index behavior for rownumberer
options.page = page;
options.start = (page-1)*options.limit;
}
this.callParent(arguments);
},
// ...
});