PDA

View Full Version : Why this.down method in initComponent before this.callParent don't work?



mrlayeghi
6 Nov 2014, 4:07 AM
Why this.down method in initComponent before this.callParent don't work?
And How to Use it, before callParent? (no after it)



.
.
.
constructor: function (config) {
//this line worked.
this.items[this.items.length - 1].issueId = config.issueId;

//this line not worked.
this.down('statusconfirm').issueId = config.issueId;

this.callParent(arguments);

//this line worked.
this.down('statusconfirm').issueId = config.issueId;
}

Tim Toady
6 Nov 2014, 8:16 AM
Because your items haven't been added yet.

For a container, initComponent calls initItems. initItems calls add(items).

So before you call the parent method, those items have not been added to the container yet. Their configuration probably exists in your items array. Once you call the parent, they are all added and componentqueries on your container will work. Does that make sense?

mrlayeghi
7 Nov 2014, 9:21 PM
ok, thanks of your replay.
How to I find my component on child before callparent ?

Tim Toady
10 Nov 2014, 6:40 AM
You will only have access to the configuration in your items array. It will not be created yet. What are you trying to achieve and why can't it wait until after callParent?