PDA

View Full Version : 4.2.1 Ext.data.Store update event



fdp
11 Jun 2013, 9:04 AM
REQUIRED INFORMATION




Ext version tested:

Ext 4.2.1.883

Description:

update event fired with wrong parameter (only first update event)

The result that was expected:

correct signature
store: Ext.data.Store
record: Ext.data.Model
operation: String
modifiedFieldNames : String[]
eOpts : Object


The result that occurs instead:

wrong parameters (missing store parameter, parameters are shifted)
record: Ext.data.Model
operation: String
modifiedFieldNames : String[]
eOpts : Object


Test Case:




Ext.define('MyApp.store.Store', {
extend: 'Ext.data.Store',

constructor: function (config) {
var me = this;
this.callParent([config]);
me.on('update', me.onUpdate);
},


onUpdate: function (store, record, operation, modifiedFieldNames) {
var desc;
switch(operation) {
case Ext.data.Model.EDIT:
desc = 'Updating record...';
break;
case Ext.data.Model.COMMIT:
desc = 'Record was updated';
break;
case Ext.data.Model.REJECT:
desc = 'Something went horribly wrong and Data was rejected';
break;
default:
desc = 'Unknown operation:' + operation;
}
console.log('Update of Store ' + this.$className + ' ' + desc);
},


});




HELPFUL INFORMATION


Only the first update event comes with wrong parameters
Next update events have right parameters


Debugging already done:

none

Possible fix:

not provided

slemmon
11 Jun 2013, 12:25 PM
Are you intending to overwrite store's private onUpdate method with MyApp.store.Store?

fdp
11 Jun 2013, 11:52 PM
No, I would like to have a function "onUpdate" that is called on every Store update event (I would not interfere with store private update code).

What I'm telling you is that the update event that I'm binding to, is called twice on every update but the first time it is called with wrong arguments (all but store argument), the second time it is called with arguments as for function signature.

I use json reader and writers.

evant
12 Jun 2013, 12:08 AM
You're overwriting a private method on the store, it gets called internally. Use a different name for your method.

fdp
12 Jun 2013, 12:35 AM
Thanks, my fault.