Skip to Content
avatar image
Former Member

Rows binding without fieldname into table

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jun 07, 2017 at 08:54 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded