I am trying to populate a DDL from an XML file. There are four items in the XML file, but I get only one item in the DDL which has the description of all four items concatenated together. I have tried this with Firefox and Chrome. The XML looks like this:
<?xml version=”1.0″?>
<result>
<action>getDDL</action>
<status>0</status>
<message>Success</message>
<list>
<item>
<id>1</id>
<description>Home</description>
</item>
<item>
<id>2</id>
<description>Work</description>
</item>
<item>
<id>3</id>
<description>Home 2</description>
</item>
<item>
<id>4</id>
<description>Other</description>
</item>
</list>
</result>
And the Javascript is:
var source = {
datatype: “xml”,
datafields: [
{ name: ‘Display’, map: ‘description’, type: ‘string’ },
{ name: ‘Value’, map: ‘id’, type: ‘int’ }
],
url: ‘http://’ + me.domain + ‘/mmXML.php?action=getDDL&type=’+type,
root: ‘list’,
id: ‘Value’,
member: ‘item’
};
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#”+inp.id).jqxDropDownList({
source: dataAdapter,
theme: ‘classic’,
width: width,
height: 25,
selectedIndex: 0,
displayMember: ‘Display’,
valueMember: ‘Value’
});
I searched the forums, but did not see anything like this. I tried different settings for the source.id value, but nothing works. Any ideas?
Thanks,
Andrew