[英]How to Get all items from Form panel?
如何從Extjs 5.0中的FormPanel獲取所有項目?
Ext.ComponentQuery.query('#ownform')[0].query('.field').forEach(function(item){});
該代碼適用於文本框和組合框,但我的表單包含網格和按鈕等。
我的建議是,嘗試首先獲取基本表單myform.getForm(),然后使用下面的示例使用getFields方法。
var form = this.up('form').getForm();
form.getFields().each(function(item){
item.setRawValue('test1');
});
根據您所說的“來自FormPanel的所有項目”的意思,有不同的答案。
如果要所有后代項/組件:
Ext.ComponentQuery.query('#ownform component');
如果您希望所有直接子項/組件:
Ext.ComponentQuery.query('#ownform > component');
有關構建組件查詢選擇器的更多信息,請參見Ext JS 5.0 Ext.ComponentQuery文檔 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.