I’m trying to create a Listbox using a DataAdapter as my source. I have it working, however, the page is making two ajax calls. The first call is when I set my DataAdapter and the second call is when I add my source to my listBox. The problem is that I’m using displayMember and valueMember. I’ve tried all sorts of different methods to parse the JSON into a javascript array and to use that as my source, but I’ve been unsuccessful. Could someone please point me in the right direction.
Here’s my code.
var sourceSchool = { datatype: "json", datafields: [ { name: 'ProfileSchools', type: 'string' }, { name: 'numberSchools', type: 'string' } ], url: 'profile_data.asp', data: { action: 'School' } };
var adapterSchool = new $.jqx.dataAdapter(sourceSchool, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + sourceSchool.url + '" : ' + error); }});
$("#allSchoolsBox").jqxListBox({ source: adapterSchool, selectedIndex: 0, displayMember: "ProfileSchools", valueMember: "numberSchools", filterable: true, theme: 'berkeley', allowDrag: false, allowDrop: false, width: '80%'});
Thanks