extjs - Ext JS Dependent combo box -
i new extjs, , trying implement following functionality:
i have 2 select drop down menus, transformed using extjs. how can make sure if value in 1 combo box selected, other value should set default value?
thanks.
edited: code till now:
ext.onready(function(){ var converted = new ext.form.combobox({ typeahead: true, triggeraction: 'all', transform:'id_select1', width:600, forceselection:true, emptytext:'select' }); var convertedcdr = new ext.form.combobox({ typeahead: true, triggeraction: 'all', transform:'id_select2', width:600, forceselection:true, emptytext:'select' }); });
i using coldfusion query database , populate drop down menus:
<cfquery name="getdata1" datasource="abc"> select * table1 </cfquery> <cfquery name="getdata2" datasource="abc"> select * table2 </cfquery> <select name="select1" id="select1"> <cfoutput query="getdata1"> <option value="#getdata1.id#">#getdata1.name#</option> </cfoutput> </select> <select name="select2" id="select1"> <cfoutput query="getdata2"> <option value="#getdata2.id#">#getdata2.name#</option> </cfoutput> </select>
edited - haven't used cfm... you'll need figure out how load cf using data stores use technique.
you need add listener select event on combo:
xtype: 'combo', id : 'firstcomboid', listeners: { select: function(combo, record, index ) { var selval = ext.getcmp('firstcomboid').getvalue(); var secondcombo = ext.getcmp('secondcomboid'); secondcombo.store.reload({params: {yourparametername: selval}}); }
basically doing following here:
- get value selected in first combo
- get reference second combo's data store
- reload store of second combo box using selected value first combo
Comments
Post a Comment