[英]How to Get all items from Form panel?
How to get all items from the FormPanel in Extjs 5.0? 如何从Extjs 5.0中的FormPanel获取所有项目?
Ext.ComponentQuery.query('#ownform')[0].query('.field').forEach(function(item){});
The code is working for textbox and combobox but my form contains grids and buttons etc. 该代码适用于文本框和组合框,但我的表单包含网格和按钮等。
My suggestion for you is , try to get the Basic Form first myform.getForm() and then use getFields method like example below . 我的建议是,尝试首先获取基本表单myform.getForm(),然后使用下面的示例使用getFields方法。
var form = this.up('form').getForm();
form.getFields().each(function(item){
item.setRawValue('test1');
});
Depending on what you mean by "all items from the FormPanel" there are different answers for this question. 根据您所说的“来自FormPanel的所有项目”的意思,有不同的答案。
If you want all descendant items/Components: 如果要所有后代项/组件:
Ext.ComponentQuery.query('#ownform component');
If you want all direct children items/Components: 如果您希望所有直接子项/组件:
Ext.ComponentQuery.query('#ownform > component');
Please see the Ext JS 5.0 Ext.ComponentQuery doc for more information on buidling component query selectors. 有关构建组件查询选择器的更多信息,请参见Ext JS 5.0 Ext.ComponentQuery文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.