Here is the store code:
Ext.define('NG.store.WhatsNews', {
extend: 'NG.store.AbstractStore',
model: 'NG.model.auxClasses.notifications.WhatsNew',
alias: 'store.whatsnewstore',
autoLoad:true,
buffered: true,
pageSize: 50,
proxy: {
type: 'rest',
url: 'api/WhatsNew/'
}
});
Here is the model:
Ext.define('NG.model.auxClasses.notifications.WhatsNew', {
extend: 'Ext.data.Model',
idProperty:'iD',
fields: [
{ name: 'iD', type: 'int' },
{ name: 'createDate', type: 'date', dateFormat: 'c' },
{ name: 'businessArchive', type: 'string' },
{ name: 'isPin', type: 'boolean' },
{ name: 'previousWhatsNewEvents' }
],
// self association model
associations: [{
type: 'hasMany',
model: 'auxClasses.notifications.WhatsNew',
name: 'previousWhatsNewEvents',
primaryKey: 'id',
associationKey: 'previousWhatsNewEvents'
}
});
Here is the code from the controller:
init: function () {
var me = this;
me.control({
'whatsnewlist': {
whatsnewpinclick: function (rowIndex) {
var me = this,
store = me.getWhatsNewsStore(),
record = store.getAt(rowIndex);
record.set('isPin', !record.get('isPin'));
store.sync(); <<< THIS IS WHERE I FAILED
}
});
}...
Here is the error from the framework: (it fails under the store getNewRecords method)
It seems that Ext.data.PageMap class does not hold a definition for filterBy method.
Is that a known issue?
Is there a workaround?
Buffered store doesn't support create/edit/delete operations. Here you can find some description about that issue: http://www.sencha.com/forum/showthread.php?251648-Ext-4.2.0-Beta-Object-object-Object-has-no-method-filterBy
As a workaroud you can create another 'copy' store without buffering (but again with paging if you need). do create/delete/edit operations on that store and then reload the original store. I haven't try this, but I think it will work.
Or, if you need only update records, you can use save() function of the model. I've tried this and it worked.
Or instead of buffered store you can use 'bufferedrenderer' plugin of grid: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.plugin.BufferedRenderer