PDA

View Full Version : Combobox Defaultfield changes to valuefield upon selection



Anand_k
29 Oct 2009, 3:02 PM
hi,

Im new to EXTJS. I have a combobox with the data loaded from the XML. When I make a selection in the combobox, the defaultfiled chages to valufield in the combobox. I need defaultfield to be displayed when selected, passing the valuefield.

Please help me with this.
XML::
<?xml version="1.0" ?>
- (http://topaxabxt001.bnsf.com:9081/CAPI/CAPIAjaxController?hnd=datautil&cmd=getgvntyp#) <root>
- (http://topaxabxt001.bnsf.com:9081/CAPI/CAPIAjaxController?hnd=datautil&cmd=getgvntyp#) <GVN_TYP_REC>
<GVN_TYP_ID>2009-10-26 15:20:34.127</GVN_TYP_ID>

<GVN_NME>Waco Gov Rights</GVN_NME>

<CAPI_GY_RGN>Gulf North</CAPI_GY_RGN>

<GVN_TYP_DESC>2:1 Points</GVN_TYP_DESC>

</GVN_TYP_REC>


- (http://topaxabxt001.bnsf.com:9081/CAPI/CAPIAjaxController?hnd=datautil&cmd=getgvntyp#) <GVN_TYP_REC>
<GVN_TYP_ID>2009-10-24 15:14:45.37</GVN_TYP_ID>

<GVN_NME>Krebs Governaing Rights</GVN_NME>

<CAPI_GY_RGN>Gulf North</CAPI_GY_RGN>

<GVN_TYP_DESC>Overhead Only</GVN_TYP_DESC>

</GVN_TYP_REC>


- (http://topaxabxt001.bnsf.com:9081/CAPI/CAPIAjaxController?hnd=datautil&cmd=getgvntyp#) <GVN_TYP_REC>
</root>





//Data store and Combo Box definition for governing type
var GoverningTypeRecord = new Ext.data.Record.create([
{name: 'GVN_TYP_ID'},
{name: 'GVN_NME'}
]);

var GoverningTypeStore = new Ext.data.Store({
autoLoad:true,
url: contextPath + '/CAPIAjaxController?hnd=datautil&cmd=getgvntyp',
reader: new Ext.data.XmlReader({
id: 'GVN_TYP_ID',
record: 'GVN_TYP_REC'
}, GoverningTypeRecord)
});

var GoverningTypeCombo = new Ext.form.ComboBox({
fieldLabel: 'Governing Type',
hiddenName:'govtyp',
store:GoverningTypeStore ,
displayField:'GVN_NME',
valueField:'GVN_TYP_ID',
forceSelection: true,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
lazyInit: false,
selectOnFocus:true
});