Template. Referring to data items

Hi, guys!

Could you suggest me some solution to the following problem:

I have a data set, say, like this

data = [
{id:1, property1:“value11”, property2:“value12” },
{id:2, property1:“value21”, property2:“value22” },
{id:3, property1:“value31”, property2:“value31” }
];

and need to present in the template the value of property2 of the 2nd record

webix.ui({
view:“template”,
template:"???"
});

Thank you in advance! Really need your help

Hello, Alex13111.

Template stores only first data object, everything else is rejected.

You can to do something like this:

var mydata = [
    {id:1, property1:"value11", property2:"value12" }, 
    {id:2, property1:"value21", property2:"value22" },
    {id:3, property1:"value31", property2:"value31" }
 ]
webix.ui({
      view:"template",
      template:function(obj){ return obj.property2},
      data:mydata[2] 
});


Maybe, you need another component for this.

Can I ask you, what for you want to use template?