cancel
Showing results for 
Search instead for 
Did you mean: 

Rows binding without fieldname into table

Former Member
0 Kudos

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.

<table>

<columns>

<column></column><column></column><column></column>

</columns>

<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>

</items>

</table>

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

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member227918
Active Contributor
0 Kudos

no way, and whatever you are doing even for 2-3 rows its not good.

you need to modify data and prepare one with the same field names and then bind the table.

Former Member
0 Kudos

unfortunatly that's not possible because I'm consuming the data from an external webservice.