jQWidgets Forums
Forum Replies Created
-
Author
-
March 20, 2012 at 3:41 pm in reply to: Dynamic dataprovider for listbox Dynamic dataprovider for listbox #2876
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
DonaldoMarch 19, 2012 at 2:56 pm in reply to: Dynamic dataprovider for listbox Dynamic dataprovider for listbox #2853Hi 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.xmlI cant see what Im missing
Thanks
DonaldoMarch 18, 2012 at 11:39 am in reply to: Dynamic dataprovider for listbox Dynamic dataprovider for listbox #2826Looks like my xml was cropped. again . .
swf/slide1.swf
Slide 1
1swf/slide2.swf
Case: TM
278swf/slide3.swf
Criteria for Manic Episode
906March 18, 2012 at 11:35 am in reply to: Dynamic dataprovider for listbox Dynamic dataprovider for listbox #2825Peter,
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 xmlswf/slide1.swf
Slide 1
1swf/slide2.swf
Case: TM
278swf/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 -
AuthorPosts