PDA

View Full Version : ComboBox only loads first data string not all data strings.



Mthor
4 Nov 2009, 9:48 AM
below is my xml and below that is my store and combobox. not sure why the mapping is only selecting the first availableFax/did, I need the whole list to be in the combobox and only the first value of <availableFaxDIDs><did>2902338801</did> no other <did> values get loaded in the drop down

<response>
<data>
<domain>
cttestpanisonic.com
</domain>
<mailbox>
pdawson@cttestpanisonic.com
</mailbox>
<start>
0
</start>
<limit>
20
</limit>
<sort>
faxNumber
</sort>
<query>
</query>
<order>
ASC
</order>
<userFaxDIDs>
<did primary="true">
9184839025
</did>
</userFaxDIDs>
<availableFaxDIDs>
<did>
2902338801
</did>
<did>
2902338802
</did>
<did>
2902338803
</did>
<did>
2902338804
</did>
<did>
2902338805
</did>
<did>
2902338806
</did>
<did>
2902338807
</did>
<did>
2902338808
</did>
<did>
2902338809
</did>
</availableFaxDIDs>
</data>
</response>

Store

var store = new Ext.data.Store({
proxy: proxy,
remoteSort: true,
reader: new Ext.data.XmlReader({
record: 'data',
id: '@id',
totalRecords: 'total'
},
[{
name: 'domain'
},
{
name: 'mailbox'
},
{
name: 'faxDID',
mapping: 'userFaxDIDs/did'
},
{
name: 'availableFax',
mapping: 'availableFaxDIDs/did'
}])
});

combobox

var FAX = new Ext.form.ComboBox({
name: 'faxNumber',
id: 'faxNumber',
fieldLabel: 'Fax Number',
allowBlank: true,
store: store,
mode: 'local',
valueField: 'availableFax',
dataIndex: 'availableFax',
displayField: 'availableFax',
triggerAction: 'all',
selectOnFocus: true
});

thanks for the help

Mthor
4 Nov 2009, 1:53 PM
I SOLVED THIS ISSUE

I changed the xml to

<userFaxDIDs>
<did primary="true">
9184839025
</did>
</userFaxDIDs>
<userFaxDIDs>
<did>
2902338803
</did>
</userFaxDIDs>
<userFaxDIDs>
<did>
2902338802
</did>
</userFaxDIDs>
<userFaxDIDs>
<did>
2902338801
</did>
</userFaxDIDs>
<availableFaxDIDs>
<did>
2902338804
</did>
</availableFaxDIDs>
<availableFaxDIDs>
<did>
2902338805
</did>
</availableFaxDIDs>
<availableFaxDIDs>
<did>
2902338806
</did>
</availableFaxDIDs>
<availableFaxDIDs>
<did>
2902338807
</did>
</availableFaxDIDs>
<availableFaxDIDs>
<did>
2902338808
</did>
</availableFaxDIDs>
<availableFaxDIDs>
<did>
2902338809
</did>
</availableFaxDIDs>

comboStore

var comboStore = new Ext.data.Store({
proxy: comboProxy,
remoteSort: true,
reader: new Ext.data.XmlReader({
record: 'availableFaxDIDs',
id: '@id',
totalRecords: 'total'
},
[{
name: 'select',
mapping: '@select'
},
{
name: 'did'
}])
});

combo

var FAX = new Ext.form.ComboBox({
name: 'faxNumber',
id: 'faxNumber',
fieldLabel: 'Fax Number',
allowBlank: true,
store: comboStore,
mode: 'local',
dataIndex: 'did',
displayField: 'did',
triggerAction: 'all',
selectOnFocus: true
});