504
windows
Extjs中彈出框動態綁定form和按鈕
直接貼代碼.
窗體代碼:
/** * 窗體 */ Ext.define('nac.reportForm.view.FormWindow', { extend : 'Ext.window.Window', alias:'widget.FormWindow', id:'FormWindow', width : 450, autoHeight:true, layout : 'fit', constrain : true, modal : true, closeAction : 'destroy', title : '窗體', frame : true, items : [{xtype:'NewForm'}], buttonAlign : 'center', buttons : [{ text : '確定', ref:'NewOK' },{ text : '重置', ref:'NewReset' },{ text : '取消', ref:'NewCancle' }] });
控製器Controller代碼:
var win=Ext.create('nac.reportForm.view.FormWindow'); win.remove(0); var btns=win.getDockedItems('toolbar[dock="bottom"]') var items=win.getDockedItems('toolbar[dock="bottom"]')[0].items; items.items[0].ref="OtherOK";//確定 items.items[1].ref="OtherReset";//重置 items.items[2].ref="OtherCancle";//取消 var view = Ext.create('nac.reportForm.view.OtherForm'); win.add(view).doLayout(); //重新布局一下 win.show();按鈕的其他設置,雷同,直接把ref改為其他屬性,即可。其他的標題,窗體大小之類的直接看api,就不用說了。如果還有不動的請主動聯係我。個人qq532009913.運行之後的效果圖這裏就不截圖了。
最後更新:2017-04-03 12:55:50