Datatable, column, collection, multidata

Hello.

How can i do the thing below ?

Example i have a datatable with 2 column (id, service)
And my data : [{id:1, service:“1”},{id:2, service:“1,2”},{id:3, service:“1,2,3”}]
My collection map for SERVICE: [{id:1,value:‘Fix’},{id:2,value:‘Throw’},{id:3,value:‘Sold’}]

How to show it in datatable like below:
[ ID ] [ SERVICE ]
[ 1 ] [ Fix ]
[ 2 ] [ Fix, Throw ]
[ 3 ] [ Fix, Throw, Sold ]

Greetings,

To tune data presenting in datatable columns is possible with Data Templates. You could do something like this: Code Snippet

1 Like

const data = [{id:1, service:‘1’},
{id:2, service:‘1,2’},
{id:3, service:‘1,2,3,1,1,1,3,2’}]

const SERVICE = [
{id:1,value:‘Fix’},{id:2,value:‘Throw’},{id:3,value:‘Sold’},{id:3,value:‘haah’}
];

webix.ui({
view:“datatable”,
columns:[
{ id:“id”, header:“Column 1”},
{ id:“service”, header:“Column 1”, width:300, template: function (obj) {
let a="";
webix.message(obj.service)
if (obj.service) {
a = obj.service.split(",").map(e=>(SERVICE.find(s=>s.id==e)||{}).value).join("_")
}
return a
}}
],
data:data
});

Here. The answer