i am calling the init
function after the initComponent
has finished and form is active.
To test I set it up like this:
console.log(this.store);
console.log(this.store.getAt(0));
The first one shows the store - and store has data. Second one returns undefined.
Why is that so? If the first console.log
shows the data - it should already be available also for the second one.
init: function() {
var rec = this.store.getAt(0);
this.setValues(rec);
this.id = rec.id;
}
Just wait for the load event on the store before accessing it's data. I Guess that the console is quite smart, updating content when object is changing.
init: function(){
this.store.on('load', function(){
var rec = this.store.getAt(0);
this.setValues(rec);
this.id = rec.id;
}, this);
}