PDA

View Full Version : AutoResize TextField's Labels



luigi
31 Aug 2007, 6:24 AM
Hi, in my app I build a dinamyc form by reading an array of field's name.

var formFilter = new Ext.form.Form({});
for(i=0;i<fields.length;i++){
textFields[i] = new Ext.form.TextField({
fieldLabel: fields[i],
name: fields[i],
width:175,
allowBlank:true,
grow: true
});
formFilter.add(textFields[i]);
}


I dont know the length of labels before, so i'd like to set labelWidth of my formFilter after i created it. The matters are:
- how can i get the label size in pixel? The labels are build by TextField constructors, so i havent a reference to them.
- how can i set labelWidth after the form is build? I looked for a setLabelWidth method but i havent found it, i tryed "formFilter.labelWidth = 400; " just before render the form, but it doesnt work.

I'm wondering about "fieldLabel" config parameter in TextField constructor i found it in dynamic.js examples, and it works in my code too, but i cant find it in documentation API neither in ext-all-debug.js... how can it works?