extjs - Adding combobox to panel on click of a button - Ext JS -
so have panel here several components:
{ xtype: 'panel', padding: 5, height: 500, width: '35%', //query builder items: [ { xtype: 'combobox', padding: 5, fieldlabel: 'search in', store: states, displayfield: 'field1' }, { xtype: 'button', text: 'add', itemid: 'add_criteria' }, { xtype: 'combobox', padding: 5, region: 'east', fieldlabel: 'criteria 2', itemid: 'combo2', hidden: true }, ...
i have controller set listens add button clicked. want add on combobox (and maybe textfield well?) each time user clicks button. comboboxes added panel going down vertically.
any ideas?
edit: updated extjs 4.2.
i've made working example. http://jsfiddle.net/cmvqt/
html:
<div id="panel"></div>
extjs:
ext.require([ 'ext.panel.*', 'ext.form.field.*' ]); ext.onready(function(){ function addcombobox(){ panel.add({xtype: 'combobox'}); } panel = ext.create('ext.panel.panel',{ xtype: 'panel', renderto: 'panel', padding: 5, height: 500, width: '35%', items: [{ xtype: 'button', text: 'add', handler: addcombobox }] }); });
Comments
Post a Comment