In my ExtJS app, I want the ability to add a specific class name to xtype's (regardless if xtype is a button, checkbox, text field, grid panel item etc) throughout my app if the itemId/name matches list/dictionary of id's that I have.
Is this possible?
So let's pretend this is how my code currently looks like when defining elements
{
xtype: 'button',
text: 'some text',
id:'elementA',
cls: 'mycustomclass'
},
{
xtype: 'checkbox',
itemId: 'chkBoxC',
id:'elementC',
cls: 'mycustomclass'
},
{
xtype: 'button',
text: '',
id:'elementB'
}
So in above snippet what I want to happen is (pseudo-code)
if (xtype.items.id == 'elementA' or xtype.items.id= 'elementC')
add class = "mycustomclass"
I want to be able to avoid sprinkling mycustomclass within all my files and continue to keep it looking below.
Where can I override?
{
xtype: 'button',
text: 'some text',
id:'elementA',
},
{
xtype: 'checkbox',
itemId: 'chkBoxC',
id:'elementC'
},
{
xtype: 'button',
text: '',
id:'elementB'
}
You can override
initComponentin all types.Ex.
You can try to override just
Ext.Componentwhich is base for checkbox, fields etc. (extjs 7.1 example)