Skip to Content
0

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

Oct 26, 2017 at 01:45 PM

33

avatar image
Former Member

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

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

3 Answers

Shilpa Ramamurthy
Oct 27, 2017 at 07:03 AM
0

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");
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0
Jose Muñoz Herrera Oct 27, 2017 at 07:31 AM
0

Hi,

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

Is that correct?

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

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

0
avatar image
Former Member Nov 13, 2017 at 07:24 AM
0

still didn't find any solutions

Share
10 |10000 characters needed characters left characters exceeded