Romeo Mihalcea
Romeo Mihalcea

Reputation: 10252

extjs 4 form loadRecord won't actually load it

I've upgraded my project from 4.0.7 to latest: 4.2.1 and I noticed all my forms stopped loading the record. If I open an update form on some user the form remains blank where in 4.0.7 works.

I'm using:

var form = Ext.create('Ext.form.Panel', {
    .......


form.on("render", function(form) {
    form.loadRecord(win.record);
}, this);

A console.log on the record itself returns:

constructor {raw: Object, modified: Object, data: Object, hasListeners: HasListeners, events: Object…}
data: Object
    active: 1
    date_added: Sun Aug 04 2013 19:32:40 GMT+0300 (EEST)
    email: "[email protected]"
    id: 1636
    username: "xxxxxxxx"
__proto__: Object
events: Object
hasListeners: HasListeners
id: "AP.model.User-1636"
index: 1
internalId: 1636
modified: Object
phantom: false
raw: Object
store: constructor
stores: Array[1]
__proto__: Object

I can see the data holding the right values but I don't know why isn't the record loaded in the form. I know I can use the url param on the form itself and load the record but I prefer knowing if something changed in the way one should use loadRecord on a form.

Much appreciated

Upvotes: 2

Views: 1859

Answers (1)

Darin Kolev
Darin Kolev

Reputation: 3409

I think your problem is the event. Try to load the form on 'afterrender':

form.on("afterrender", function(form) {
    form.loadRecord(win.record);
}, this);

Upvotes: 2

Related Questions