PDA

View Full Version : The parameter 'operation' of the Store event 'load' is empty



Qtx
27 May 2011, 7:31 AM
I have a JsonStore with a handler 'load'. The API says

load( Ext.data.store this, Array records, Boolean successful, Ext.data.Operation operation )

Parameters

this : Ext.data.store
records : Array

An array of records
successful : Boolean

True if the operation was successful.
operation : Ext.data.Operation

The associated operation

When this event occurs, the operation object is empty. I tried to debug and found out the following.

The object Ext.data.proxy.Server has the method 'processResponse'. In this method, the call back functions are called over firing the event (Server.js, line 258)


if (typeof callback == 'function') {
callback.call(scope || me, operation);
}


On this step, the object 'operation' has still all properties. But when the load event of the Store is called, the object 'operation' is empty.

Qtx
27 May 2011, 7:40 AM
The call callback.call(scope || me, operation) calls the method onProxyLoad of the Store and passes the object 'operation'. It has still all properties.

The file Store.js, line 970.


onProxyLoad: function(operation) {
var me = this,
resultSet = operation.getResultSet(),
records = operation.getRecords(),
successful = operation.wasSuccessful();

if (resultSet) {
me.totalCount = resultSet.total;
}

if (successful) {
me.loadRecords(records, operation);
}

me.loading = false;
me.fireEvent('load', me, records, successful);


But the call me.fireEvent('load', me, records, successful) does not pass the parameter 'operation' at all. And this call initiates the load event of the Store.

Qtx
27 May 2011, 7:46 AM
Modification

me.fireEvent('load', me, records, successful);

to

me.fireEvent('load', me, records, successful, operation);

solves the problem!

please, put this into the next release!