Hello,
I have some trouble figuring out how to select deep data from a nested data source.
Here’s my code :
var list_interveners = webix.ui({
view:"list",
container:"list_interveners",
select:true,
url:"http://local/users/list",
template:"#lastName# #firstName#",
on: {
"onItemClick":function(id){
linked_set = new webix.DataCollection({
url: "http://local/users/user/" + id
});
list_contacts.parse(linked_set);
}
}
});
var list_contacts = webix.ui({
container:"contact_datatable",
view:"datatable",
columns:[
{
id:"number",
header:"number",
template:"#phones#"
},
],
autoheight:true,
autowidth:true
});
list_contacts.bind(list_interveners, function(slave, master){
if (!master) return false;
return master.id == slave.id;
});
And here’s the JSON :
{
“url”:“http:\/\/local\/images\/avatar\/”,
“data”:{
“id”:2,
“avatar”:“default.jpg”,
“title”:“Mr”,
“first_name”:“testWebix”,
“last_name”:“webixTest”,
“function”:“Company”,
“language”:“english”,
“phones”:{
“1”:{
“id”:1,
“type”:“office”,
“number”:"+32 1 234 56 78",
“country”:{
“id”:21,
“iso”:“BE”,
“iso3”:“BEL”,
“name”:“BELGIUM”,
“nice_name”:“Belgium”,
“phone_code”:32
},
“note”:null
},
“2”:{
“id”:2,
“type”:“fax”,
“number”:"+32 1 234 56 79",
“country”:{
“id”:21,
“iso”:“BE”,
“iso3”:“BEL”,
“name”:“BELGIUM”,
“nice_name”:“Belgium”,
“phone_code”:32
},
“note”:null
},
“3”:{
“id”:3,
“type”:“private”,
“number”:"+32 2 345 67 89",
“country”:{
“id”:21,
“iso”:“BE”,
“iso3”:“BEL”,
“name”:“BELGIUM”,
“nice_name”:“Belgium”,
“phone_code”:32
},
“note”:null
},
},
}
}
How can I have the datatable displaying each phone number as a row ?
What is displayed is “[object Object]”, and I saw nowhere how to display this nested json properly.
Thanks for the help.