[英]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.