Hello and congratulations for this great library !
Although I red all posts I didn’t find an answer to the following problem:
I would like to have a custom rendering in combination with json from database. I could use your example “Custom Rendering” but the problem is that you use hardcoded data. So I tried to build the array data in order to use it later in the listbox but I get no data.
This is my code:
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘LAST_NAME’},
{ name: ‘FIRST_NAME’},
{ name: ‘ID_PERSON’},
{ name: ‘MOBILE_PHONE’},
{ name: ‘PLATE’},
],
url: ‘listboxdata.php’
};
var data = [];
var dataAdapter = new $.jqx.dataAdapter(source);
$.each(source, function(i, obj) {
data[“LAST_NAME”]=obj.LAST_NAME;
data[“FIRST_NAME”]=obj.FIRST_NAME;
data[“ID_PERSON”]=obj.ID_PERSON;
data[“MOBILE_PHONE”]=obj.MOBILE_PHONE;
data[“PLATE”]=obj.PLATE;
});
$(‘#listbox’).jqxListBox(
{
source: dataAdapter,
theme: ‘darkblue’,
width: ‘100’,
height: ‘100%’,
selectedIndex: 0,
displayMember: ‘LAST_NAME’,
valueMember: ‘FIRST_NAME’,
itemHeight: 70,
renderer: function (index, label, value) {
var datarecord = data[index];
var imgurl = ‘../../images/’ + label.toLowerCase() + ‘.png’;
var img = ‘
‘;
var table = ” + img + ” + datarecord.FIRST_NAME + ” ” + datarecord.LAST_NAME + ” + datarecord.PLATE + ”;
return table;
}
});
Thanks in advance.
Best Regards
Vangelis Komninos