Skip to Content
Former Member
Jun 06, 2017 at 02:30 PM

Rows binding without fieldname into table

107 Views Last edit Jun 06, 2017 at 02:31 PM 2 rev

Hi, I have a Json model in my SAPUI5 app and I want to bind it to a table. I have the table already with columns and items: lets say 3 columns and 3 rows.





<items> <ColumnListItem> <cells></cells><cells></cells><cells></cells></ColumnListItem>

<ColumnListItem> <cells></cells><cells></cells><cells></cells></ColumnListItem>

<ColumnListItem> <cells></cells><cells></cells><cells></cells></ColumnListItem>



I would like to bind dinamically without having to specify text="{/field}" because my Json has 3 arrays that go each to 1 row and the field names aren't the same. Is this possible ?

For example:

var data = {

0: [ {firstname:"AA", lastname: "BB", Phone: "123"}, ],

1: [ {firstnameParent:"AB", lastnameParent: "BC", Phone: "456"},],

2: [ {firstnameGtParent:"ABC", lastnameGtParent: "CC", Phone: "555"},]}

Right now I'm placing for each cell text="{/0/firstname}"text="{/0/lastname}"text="{/0/phone}" and next row text="{/1/firstnameParent}"text="{/1/lastnameParent}"text="{/1/phone}" but the example has 3 cells and if I had more it doesn't sound like a good idea .

Is it possible ? to bind without specifiing the fieldname? I've tried different options but without any success.

Expected table output

col1 | col2 | col3

AA | BB | 123

AB | BC | 456

ABC | CC | 555