View Full Version : auto labelWidth

6 Aug 2009, 11:45 PM
Our field labels are dynamic and may have different width (we use max character constraint).
But while showing in form I need some how auto adjustment of label's width with respect to maximum length of field label.

Is it possible?

Or do I have to use Ext.util.TextMetrics.measure function to set field label width?


7 Aug 2009, 12:06 AM
You could extend FormLayout, so it doesn't set a width for the label. After all fields are rendered, you could find the largest field label width and apply it to all fields.

(Ext.util.TextMetrics.measure isn't required - you should avoid it if possible, because it's slow)

Wouldn't it be easier to use TableLayout with separate Label components?