PDA

View Full Version : Can't override Ext.form.Labelable.getLabelCellAttrs



delegans
27 Jul 2012, 7:25 AM
Before, field label style is valign="top"


<td id="filefield-1082-labelCell" style="" valign="top" halign="right" width="245" class="x-field-label-cell">
<label id="filefield-1082-labelEl" for="filefield-1082-inputEl" class="x-form-item-label x-form-item-label-right" style="width:240px;margin-right:5px;vertical-align: middle;">
Label:
</label>
</td>


Try to override Ext.form.Labelable and set valign="middle"


Ext.override('Ext.form.Labelable',{

getLabelCellAttrs: function() {
console.log("I'm here");
var me = this,
labelAlign = me.labelAlign,
result = '';


if (labelAlign !== 'top') {
result = 'valign="middle" halign="' + labelAlign + '" width="' + (me.labelWidth + me.labelPad) + '"';
}
return result + ' class="' + Ext.baseCSSPrefix + 'field-label-cell"';
}
});



After, field label style is valign="top" anyway:


<td id="filefield-1082-labelCell" style="" valign="top" halign="right" width="245" class="x-field-label-cell">
<label id="filefield-1082-labelEl" for="filefield-1082-inputEl" class="x-form-item-label x-form-item-label-right" style="width:240px;margin-right:5px;vertical-align: middle;">
Label:
</label>
</td>


Does override bug or I something misunderstand?