开发者

ExtJS FormPanel Change labelWidth after adding fields dynamically

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 red开发者_如何学编程raw the form, thanks.


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();


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜