【发布时间】:2020-07-22 17:36:45
【问题描述】:
在我的ExtJS 应用程序中,如果 itemId/name 与列表匹配,我希望能够在整个应用程序中向 xtype 中添加特定的类名(无论 xtype 是按钮、复选框、文本字段、网格面板项等) /我拥有的 id 的字典。
这可能吗?
所以让我们假设这是我的代码在定义元素时的当前样子
{
xtype: 'button',
text: 'some text',
id:'elementA',
cls: 'mycustomclass'
},
{
xtype: 'checkbox',
itemId: 'chkBoxC',
id:'elementC',
cls: 'mycustomclass'
},
{
xtype: 'button',
text: '',
id:'elementB'
}
所以在上面的 sn-p 中我想要发生的是(伪代码)
if (xtype.items.id == 'elementA' or xtype.items.id= 'elementC')
add class = "mycustomclass"
我希望能够避免将mycustomclass 洒在我的所有文件中,并继续保持在下方。
我可以在哪里覆盖?
{
xtype: 'button',
text: 'some text',
id:'elementA',
},
{
xtype: 'checkbox',
itemId: 'chkBoxC',
id:'elementC'
},
{
xtype: 'button',
text: '',
id:'elementB'
}
【问题讨论】: