Skip to Content
0
Former Member
May 05, 2014 at 11:21 PM

SAPUI5 table bindRows

4799 Views

Hello guys,

I am currently trying to create a table with sapui5 in the Design Studio SDK and bind data from DS to it, but I cant see any values in the created table:

var oTable = new sap.ui.table.Table({
                title: "testtab",
                selectionMode: sap.ui.table.SelectionMode.Single
            });
           
                        
            var oColumn = new sap.ui.table.Column({
                label: new sap.ui.commons.Label({text: "Currency"}),
                template: new sap.ui.commons.TextField().bindProperty("value", "currency"),
                sortProperty: "currency",
                filterProperty: "currency",
                width: "100px"
            });

           
            var oModel = new sap.ui.model.json.JSONModel();
            oModel.setData({dimensions: meta_data.dimensions});
           
            oTable.bindRows("/dimensions");
            oTable.setModel(oModel);

            oTable.sort(oTable.getColumns()[0]);
            oTable.placeAt(this.$());

My data source is a cube metadata, e.g:

{ dimensions: { key: currency, text: Currency, members: [ { key: 001, text: EUR }, { key: 002, text: USD } ] }

Json above is just an example. (Not the full object)

The problem is that the required values are in the "members" -> How can I bind them correct?

The result should be a table like the one you see when you go on "Edit Initial View".

Best regards,

Adam