PDA

View Full Version : [CLOSED] Ext.data.Model.load() doesn't work due to recordCreator



romainpicxi
4 Jun 2014, 4:32 AM
When I want to load a record with the load method of a model or with a link (linkTo), my record is correctly loaded from the server but my object isn't updated.


The problem come from the Reader and its extractRecord method that use the default recordCreator method.
In Ext.data.reader.Reader.extractRecord() you test if the reader has a recordCreator method and you use the old access without the getter. See my attached patch.

evant
4 Jun 2014, 6:53 AM
readOptions is supposed to be an object literal, not something with a getter. Can you post a test case that demonstrates the issue?

romainpicxi
4 Jun 2014, 7:50 AM
In Ext.data.operation.Operation, the recordCreator is defined in config, so we have to use the getter or _recordCreator

evant
4 Jun 2014, 3:13 PM
Yes, but the operation passes it along when it calls the reader:



resultSet = reader.read(me.extractResponseData(response), {
// If we're doing an update, we want to construct the models ourselves.
recordCreator: operation.getRecordCreator()
});


So I'm wondering how you ever got in that state.

romainpicxi
5 Jun 2014, 12:38 AM
Ok, I understand. We use a custom proxy and in Ext 4.2 the read() method get only one parameter. In Ext 5 we add to the new second parameter (readOptions) the operation object (which has also a recordCreator method).Thanks for your help.