cancel
Showing results for 
Search instead for 
Did you mean: 

Binding items from model to Table by Rows and not by Colums

Former Member
0 Kudos

Hello Community,

could any of you know how to solve my following problem?

https://stackoverflow.com/questions/46956009/ui5-binding-items-to-tablerows-instead-of-tablecolumns


best regards, Okyanus

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

still didn't find any solutions

JoseMunoz
Active Participant
0 Kudos

Hi,

If I understand correctly you have to transpose the data first ( Transpose ) and then bind items normally.

Is that correct?

Former Member
0 Kudos

Hello yes exactly. because as I shared on the post on SO on the photo, the compared items must be horizontal

former_member206705
Participant
0 Kudos

Hi Okyanus,

If you visualize differently, you're essentially trying to bind the rows to the table itself!! Just that the "data" for your table as coming from the back-end needs to probably be re-structured. Maybe you could change it to something like this:

Lets call the properties to which the cells need to be bound as: "C1Data", "C2Data" and "C3Data"

In the view: Use 3 columns with column list item row template cells bound to C1Data, C2Data and C3Data.

Your data will look like

[ {"C1Data": "data for column1", "C2Data": "data for column2", "C3Data": "data for column3"},...]

var vergleichTable1 = new sap.m.Table(this.createId("vergleichTable1"), {

        columns: [
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "Header Text 1"
                })
            }),
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "Header Text 2"
                })
            }),
            new sap.m.Column({
                header: new sap.m.Label({
                    text: "Header Text 3"
                })
            }),
        ],
        items: {
             path: '<path to your entity',
             template: new sap.m.ColumnListItem({
                cells: [
                    new sap.m.Text({
                        text:  "{C1Data}"
                    }),
                    new sap.m.Text({
                        text:  "{C2Data}"
                    }),
                    new sap.m.Text({
                        text:  "{C3Data}"
                    })
                ]
             })
    }).addStyleClass("vergleichTable1");
Former Member
0 Kudos

Hello, thanks for your reply but I have no idea how to do what you said.

I dont recieve that "data" variable from the DB , i took it from my model.oData