ITeye博客

form component

xu_wccq · 2008-12-16 22:34 · js+css · C · C++ · EXT · C# · F# · Markdown

我们在form loadData完成之后它便可以把值设置到相应的字段去. 通过formpanel.form.findField(fieldName) 找到对应的Ext的component . 可以看formfindField()的实现


这是在 Ext.form.BaseForm 里面实现的.
findField : function (id) {
    var field = this.items.get(id);
    if (!field) {
        this.items.each(function (f) {if (f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)) {field = f;return false;}});
    }
    return field || null;
}
其中 this.items.each 这里的items 是在构造formpanel的时候,
  利用
onAdd : function(ct, c) {  // Ext.form.formPanel  (Form.js)
// 判断此component是不是formField,是否添加到this.form列表里面,待formpanel 的setValues 时把值设置到对应的component里面。
		if (c.isFormField) {
			this.form.add(c);
		}
},


评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。