Using the following code i fill a listbox from JSON data. This works perfectly.
But i have to manipulate the data before they go into the listbox.
Reading the API beforeLoadComplete seems to be the right place.
But beforeLoadComplete is never called. Only loadComplete.
What’s wrong here?
i have following data:
{“group_memberships”:
[{“group”:{“id”:1653,”name”:”Group 1″,…..},
{“group”:{“id”:2440,”name”:”Group 2″,…..}
]
}
Here is thecode i use:
var theme = “”;
var source =
{
datatype: “json”,
localdata: data,
datafields: [
{ name: ‘id’, map: ‘group>id’ },
{ name: ‘name’, map: ‘group>name’ }
],
root: ‘group_memberships’
};
var dataAdapter = new jQuery.jqx.dataAdapter(source,
{
beforeLoadComplete: function (records, original) {
console.log(“beforeLoadComplete”);
console.log(records);
return records;
},
loadComplete: function (records) {
console.log(“loadComplete”);
console.log(records);
}
}
);
jQuery(“#myListBox”).jqxListBox({ source: dataAdapter, displayMember: “name”, valueMember: “id”, width: 222, height: 250, theme: theme });
Any help is welcome.
Best Regards
Thomas