2
我定義了一個Source Window
像如何ExtJS的克隆組件(窗口)4.1
Ext.define('MyWindow', {
extend: 'Ext.window.Window',
title: 'Source Window',
modal: true,
height: 200,
width: 400,
closable:false,
tbar: [{
text:'hide',
handler:function(){
this.up('window').hide();
}
}],
items: {
xtype: 'grid',
border: false,
columns: [{header: 'World'}],
store: Ext.create('Ext.data.ArrayStore', {})
}
});
而且我刪除窗口的所有項目,然後新的項目添加到它像
var w = new MyWindow();
tf = Ext.create('Ext.form.field.Text', {
name: 'name',
fieldLabel: 'Name'
});
w.removeAll(true);
w.add(tf);
w.show();
w.hide();
現在我想克隆我的窗口(窗口添加新項)像
Ext.create('Ext.Button', {
text: 'Clone to new',
visible: false,
renderTo: Ext.getBody(),
handler: function() {
var newWin;
Ext.WindowManager.each(function(win) {
newWin = win.cloneConfig();
newWin.title = "Clone Window";
newWin.show();
});
}
});
但是,這表明Source Window
?如何解決 這裏是我完整的代碼http://jsfiddle.net/MKUSB/
無論如何都要使用'newWin.add(w.items.cloneConfig())// fail'?反正我不想使用添加ID? – freestyle
您還可以將w.getComponent(0).cloneConfig()與組件的默認數字項ID一起使用,然後不必添加文本ID。此數字項目ID始終從0開始。 – user1721713
是啊,謝謝你:) – freestyle