【发布时间】:2018-05-15 04:49:24
【问题描述】:
当我单击添加按钮时,它需要再次添加相同的容器。下面我给出了我的代码段
var rulepanel = Ext.apply(me, {
items: [{
xtype: 'uxform',
id: 'rule',
bodyPadding: 10,
items: [{
xtype: 'container',
items: [{
xtype: 'combobox',
fieldLabel: 'match',
name: 'name',
allowBlank: false,
placeholder: 'match'
}]
}, {
xtype: 'container',
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
xtype: 'combobox',
fieldLabel: 'Product/KPI',
name: 'name',
}, {
xtype: 'button',
id: 'add',
text: 'Add',
handler: function(button, event) {
//rulepanel.insert(0, Ext.create(rulepanel.model));
// so here how can I add it
}
}],
}]
}]
});
因此,当单击添加按钮时,我需要克隆“匹配、产品/kpi 和添加按钮”字段。我怎样才能完成这个任务。我尝试过使用 cloneconfig()。但达不到。提前致谢。
【问题讨论】:
-
如果你能创造一些小提琴就好了
-
您可以将应该复制的部分移动到它自己的
Ext.define块中,从而使其明确可重用。然后您可以使用Ext.create轻松创建多个实例
标签: javascript extjs containers