1

I have a dynamic FormPanel where I need to set the label width after I have loaded in all the fields. I have tried using this.labelWidth = 200 before calling this.doLayout but it's ignoring the new value.

Can someone tell me where I can set this and redraw the form, thanks.

2 Answers 2

1

After looking through the extjs source code for FormLayout I found that some variables you can set to change the label width before calling doLayout on the form.

so inside your FormPanel use the following code to change the label width:

Ext.apply(this.layout, {
    labelAdjust: this.labelWidth + 5,
    labelStyle: 'width:' + this.labelWidth + 'px;',
    elementStyle: 'padding-left:' + (this.labelWidth + 5) + 'px'
});

this.doLayout();
Sign up to request clarification or add additional context in comments.

Comments

0

Could it be that the labelWidth config option is not taken into consideration anymore after the FormPanel is rendered? Maybe you could acquire a reference to all the labels with FormPanel.findByType, set the label widths to 200, and then calling FormPanel.doLayout?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.