急extjs动态创建控件-
急、急、急--extjs动态创建控件--在线等!!
小弟因项目需要,急要动态创建ext中的控件。
具体要求是:
在FormPanel中有一个textfield a,当在a中输入一个数字时,则在FormPanel中动态的创建a中对应数字个数的combobox控件。另外当a中数字大于1时,这时候该怎么样在FormPanel中进行布局。(注:原有的form是两列布局 )
还请大虾帮个忙。万分感谢!!!
------解决方案--------------------
小弟因项目需要,急要动态创建ext中的控件。
具体要求是:
在FormPanel中有一个textfield a,当在a中输入一个数字时,则在FormPanel中动态的创建a中对应数字个数的combobox控件。另外当a中数字大于1时,这时候该怎么样在FormPanel中进行布局。(注:原有的form是两列布局 )
还请大虾帮个忙。万分感谢!!!
------解决方案--------------------
- JScript code
function createComBox(id,name) { var c = new Ext.form.ComboBox({ mode : 'local', forceSelection : true, triggerAction : 'all', displayField : 'name', fieldLabel: name, valueField : 'code', idProperty : 'code', fields : ['code', 'name'], store : [], id : id }) return c; } var form = new Ext.FormPanel({ title : "合班处理", frame : true, autoHeight : true, applyTo : Ext.getBody(), layout : "column", items : [{ columnWidth : .5, layout : "form", id : 'left', xtype : "panel", name : "leftform", items : [createComBox('dd','name1')] }, { columnWidth : .5, layout : "form", xtype : "panel", id : 'right', name : "rightform", items : [createComBox('ddd','name1')] }] })