jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList DDL items appearing on one line

This topic contains 2 replies, has 2 voices, and was last updated by  AndyNicholls 11 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • DDL items appearing on one line #46947

    AndyNicholls
    Participant

    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

    DDL items appearing on one line #46971

    Peter Stoev
    Keymaster

    Hi Andrew,

    Have you tried setting the source object’s “record” member to “item”?

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    DDL items appearing on one line #47028

    AndyNicholls
    Participant

    Thanks Peter. That worked!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.