jQWidgets Forums

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts

  • donaldo
    Member

    Hi Peter,
    Looks like I was able to get this to work by changing this line,

    $(‘#jqxListBox’).bind(‘select’, function (event) {
    var item = $(“#jqxWidget”).jqxListBox(‘getSelectedItem’);
    to

    $(‘#jqxListBox’).bind(‘select’, function (event) {
    var item = $(“#jqxListBox”).jqxListBox(‘getSelectedItem’);

    Obviously the call to #jqxWidget was not going anywhere because it did not exist in the DOM for my page.
    (I assume that #jqxWidget is the div for the listbox in your code example.)

    The jqxDataAdapter plug-in is a great time saver for wiring up xml to the listbox . . . any docs on this?

    Thanks
    Donaldo


    donaldo
    Member

    Hi Peter,
    This is not working for me. I think I must be missing something in my mapping setup for the DataAdapter plug in.
    I am able to populate the listbox fine but I cant retrieve the value of any of the selected items.
    My selections are showing up as undefinded in firebug when I run this.

    $(‘#jqxListBox’).bind(‘select’, function (event) {
    var item = $(“#jqxWidget”).jqxListBox(‘getSelectedItem’);
    // get item value.
    var itemValue = item.value;
    // get item label.
    var itemLabel = item.label;
    alert(‘Selected: ‘ + itemValue);
    });

    Here is my mapping code:

    var url = “presMobile.xml”;

    // prepare the data
    var source =
    {
    datatype: “xml”,
    datafields: [
    { name: ‘SlideName’, map: ‘Title’ },
    { value:’SlideTime’, map: ‘SlideTime’ },
    ],
    root: “Slides”,
    record: “Slide”,
    url: url
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#jqxListBox”).jqxListBox({ source: dataAdapter, displayMember: “SlideName”, valueMember: “SlideTime”, width: 224, height: 590, theme: ‘midnight’ });

    Here is a link to my xml file (have not been able to cut and paste xml code in this textbox)
    https://s3.amazonaws.com/mu1/presMobile.xml

    I cant see what Im missing
    Thanks
    Donaldo


    donaldo
    Member

    Looks like my xml was cropped. again . .

    swf/slide1.swf
    Slide 1
    1

    swf/slide2.swf
    Case: TM
    278

    swf/slide3.swf
    Criteria for Manic Episode
    906


    donaldo
    Member

    Peter,

    Thanks for your reply.
    The example with the jqxDataAdapter plug-inworks for me. Are there more docs on the adapter?

    I am able to populate the listbox fine but I am having trouble with the syntax to retrieve the value of the selected item.

    here is how i set up my data;

    var url = “presMobile.xml”;

    // prepare the data
    var source =
    {
    datatype: “xml”,
    datafields: [
    { name: ‘SlideName’, map: ‘Title’ },
    { name: ‘SlideTime’, map: ‘SlideTime’ },
    ],
    root: “Slides”,
    record: “Slide”,
    url: url
    };

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#ListBox”).jqxListBox({ source: dataAdapter, displayMember: “SlideName”, valueMember: “SlideTime”, width: 224, height: 590, theme: ‘midnight’ });

    I want to retrieve the SlideTime value from the selected item like to use in a callback handler

    $(‘#jqxListBox’).bind(‘select’, function (event) {
    var args = event.args;
    var item = $(‘#jqxListBox’).jqxListBox(‘getItem’, args.index);
    // get and alert value
    var item = item.value;
    alert(event.data.SlideTime)

    });

    ——————————————————————————————————-
    Here is my xml

    swf/slide1.swf
    Slide 1
    1

    swf/slide2.swf
    Case: TM
    278

    swf/slide3.swf
    Criteria for Manic Episode
    906

    ——————————————————————————————————

    Any suggestions as to how to properly grab selected values with the jqxDataAdapter plug-in
    in this context?
    Thanks
    Donaldo

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