Skip to Content
0

Rows binding without fieldname into table

Jun 06, 2017 at 02:30 PM

89

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Akhilesh Upadhyay Jun 07, 2017 at 08:54 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0