更新记录
点击查看
>2023年1月6日 更新Ext.getCmp
>2022年12月3日 开始。
ExtJS教程汇总:https://www.cnblogs.com/cqpanda/p/16328016.html
Finding components based on xtype:
var panels = Ext.ComponentQuery.query('panel');
nesting by adding a second xtype separated by a space.
var buttons = Ext.ComponentQuery.query('panel button');
Retrieving components based on attribute values: Along with retrieving references
var saveButton = Ext.ComponentQuery.query('button[action="saveUser"]');
Combining selectors
var buttonsAndTextfields = Ext.ComponentQuery.query('button, textfield');
Finding components based on ID:
var usersPanel = Ext.ComponentQuery.query('#usersPanel');
或者
let panel = Ext.getCmp("panel-1234");
console.log(panel);
Retrieving components based on attribute presence:
var extraOptionsComponents = Ext.ComponentQuery.query('component[extraOptions]');
Using Components' Member Functions:
var validField = Ext.ComponentQuery.query('form > textfield{isValid()}');
Evaluating a component instance's type
var isPanel = Ext.ComponentQuery.is(panel, 'panel');
最后一个子组件
var lastTextfield = Ext.ComponentQuery.query('textfield:last');
除此之外,组件自身也带有查询方法,比如:
query, child, up and down.
标签:based,ComponentQuery,查询,var,Ext,组件,query,ExtJS,panel
From: https://www.cnblogs.com/cqpanda/p/16947173.html