如何在 extjs 中使用 Ext.componentQuery.query 定位具有多个属性的元素
How to locate an element with multiple attributes using Ext.componentQuery.query in extjs
我想知道是否可以在extjs
的componentquery中使用多个属性来定位一个元素?
像下面的查询一样搜索名称为 mybutton
的按钮。我们可以在同一查询中添加更多属性,例如 class 和文本吗?
Ext.ComponentQuery.query('button[b-name="mybutton"]')
是的,这是可能的。
假设这是您要查找的元素:
{
xtype: 'label',
id:'iAmId',
itemsId: 'iAmItemId',
text: 'Hnweis: Bitte Projekt im SAP/SRM abrechnen.',
style: {
'font-weight': 'bold'
}
}
如果您想根据其 ID 和 itemId 查找此元素,您可以运行这是组件查询:
Ext.ComponentQuery.query('label[itemsId="iAmItemId"][id="iAmId"]')
我想知道是否可以在extjs
的componentquery中使用多个属性来定位一个元素?
像下面的查询一样搜索名称为 mybutton
的按钮。我们可以在同一查询中添加更多属性,例如 class 和文本吗?
Ext.ComponentQuery.query('button[b-name="mybutton"]')
是的,这是可能的。
假设这是您要查找的元素:
{
xtype: 'label',
id:'iAmId',
itemsId: 'iAmItemId',
text: 'Hnweis: Bitte Projekt im SAP/SRM abrechnen.',
style: {
'font-weight': 'bold'
}
}
如果您想根据其 ID 和 itemId 查找此元素,您可以运行这是组件查询:
Ext.ComponentQuery.query('label[itemsId="iAmItemId"][id="iAmId"]')