ilhan
ilhan

Reputation: 8995

Setting values to a form which is not rendered yet

I have a form within a tab. It is second tab so it doesn't render until you open it.

I have tried to submit data to the form with Ext.getCmp('DetailsForm').getForm().setValues(selections[0]); but it says that it is not a function. Probably because it is not rendered yet. What I have to do?

Upvotes: 1

Views: 1033

Answers (3)

sra
sra

Reputation: 23983

Set the deferredRender config property of your Ext.tab.Panel to deferredRender: false

That will force the rendering of all tabs instead of just active ones. Now the form will be there. As mentioned before I recommend you also to use myTabPanelRef.down('from').getForm().setValues(selections[0]); to access the form.

Upvotes: 3

Avinash T.
Avinash T.

Reputation: 2349

Use render event of form panel. Your code will be something like this -

Ext.getCmp('DetailsForm').on('render', function(){ this.getForm().load(selections[0]); });

Upvotes: 0

Parv Sharma
Parv Sharma

Reputation: 12705

subscribe to the second tabs show event OR painted event
then look for the form preferably by using .down() method as this wont look with in the entire DOM. set the values

Upvotes: 0

Related Questions