Load URL data to datatable but nested

Hi,

{
“Accounts”: [
{
“customer_id”: “ACC-f1537c9291ad1215cd1b714711d2abff”,
“customer_name”: “aabw Aaabw”,
“billing_address”: “maroc maroc casablanca casablanca maroc”,
“physical_address”: “maroc maroc casablanca casablanca maroc”,
“status”: “incomplete”
}]}

I am accessing this data through URL and I need to set it to datatable. I tried template:"#Accounts.customer_id" but it returns undefined

Hi, is this a sample of item data or serverside response?

(1) If it is item data, you can define column template via a function:

template:function(obj){
   return obj.Accounts[0].customer_id;
}

(2) If server responds such data as

{ "Accounts": [ { "customer_id": "A", ...},  { "customer_id": "B",  ...} ]}

you need to either change the response so that it looks like:

[{ "customer_id": "ACC1", ..},{ "customer_id": "ACC2", ..}]

Or, query the data with a separate Ajax request and parse it to the datatable in the callback:

webix.ajax("some.php", function(text, data){
   data = data.json();
   datatable.parse(data);
});

Then there will be no need in a custom template at all.