tl/dr:
There is not any setter
for labelStyle
. So how can I change it's value on a function?
I've a afterrender
listener and aim to set color of fieldLabel
as white and set a emptyText
instead of fieldLabel
and meanwhile I need to change fieldLabel
color to be white! So I need to access current component's lableStyle
property. I've try to go within config
but couldn't find it. As well tried to use Ext.apply()
to set a property for related combo but this is not work either.
How can I achieve my aim over here?
//Related component `listeners`;
listeners : {
afterrender: 'removeLabel',
focusenter: 'createLabel'
},
//Related function;
removeLabel: function () {
let formComponent = ['foocombobox', 'bartextfield', 'zetdatefield'];
Ext.each(formComponent, function (eachComp) {
let currentComp = Ext.ComponentQuery.query(eachComp)[0];
if (currentComp.value === '')) {
let currentLabel = currentComp.fieldLabel;
currentComp.setEmptyText(currentLabel);
//This can not work because of I've reach constructor config. So how can I reach?
//currentComp.labelStyle = "color:red;";
//I tried to manipulate through Ext.apply but did not effect;
//Ext.apply(currentComp, {labelStyle: "color:red;"});
}
});
},