PDA

View Full Version : How to move the default cllass for component



shiyaojun
7 Feb 2014, 7:01 PM
This is my example
item:{
xtype: 'label',
text: 'sasas',
width: 200,
cls: 'test-test-test'

}
but the real label is <label class="x-component test-test-test x-box-item x-component-default"
Is there any way to move the x-component and x-box-item x-component-default ?
I have tried to use baseCls instead, but it only can move the x-component...

palakurthivishal
7 Feb 2014, 7:31 PM
Hello shiyaojun,
Look at this snippet execution.

{
xtype: 'label',
text: 'sasas',
width: 200,
cls: 'test-test-test',
listeners : {
debugger;
afterrender : function(cmp){
var domNode= cmp.getEl().dom;
domNode.setAttribute('class', 'test');
}
}

}

shiyaojun
7 Feb 2014, 10:22 PM
Hello shiyaojun,
Look at this snippet execution.

{
xtype: 'label',
text: 'sasas',
width: 200,
cls: 'test-test-test',
listeners : {
debugger;
afterrender : function(cmp){
var domNode= cmp.getEl().dom;
domNode.setAttribute('class', 'test');
}
}

}
Thanks for answer .
I find a similar way :
{
xtype: 'label',
text: 'sasas',
width: 200,
cls: 'test-test-test',
id: 'xlb',
listeners: {
render: function () {
document.getElementById('xlb').className = 'test-test-test'
}
}
}

palakurthivishal
7 Feb 2014, 10:56 PM
Thanks for pointing me to one more way..