How to show multiple values from an array structure in a datatable cell

Hi,

I need to show more than one value together in a datatable cell. The array structure that I want to display it from is below :

id2: [{“rank”:2, “vote”:50}, {“rank”:3, “vote”:10}]

I need to show both rank and vote in one cell delimited by a space.
The constraint is I want to show only the 1st element of the array structure.

Here is the snippet : https://webix.com/snippet/1584f19a

From this link Data Mapping of Configuration, Loading Data into DataTable Webix Docs , I could only figure out that to show the first element of the array object , I can use map attribute as below :
{ id:“id2”, header:“Rank”, width:80, map:"#id2[0]#",
tempplate:“rank:#rank# vote:#vote#”},

I could figure it out on my own and the working snippet is https://webix.com/snippet/928bab77

The values needs to be used as below using map:
{ id:“id2”, header:“Rank”, width:80, map:"#id2[0].rank# : #id2[0].vote# ",
tempplate:“rank:#rank# vote:#vote#”}

Please note that the data mapping affects the real data and creates the corresponding data attributes. If you don’t want to affect the data, you can set the template (which is an advanced rendering pattern, nothing more) as follows: https://webix.com/snippet/68ccad2b

Hi Listopad,

Thanks for this post. Just wanted to know is there any way to define a function in a controller file and only calling that from template by its name for example: ‘show_values’ as below :

template : show_values(obj)

Because this is giving error as obj is not defined.

Parameters will be passed automatically: https://webix.com/snippet/73c83b8f

Thanks a lot.