on 2014 May 06 12:21 AM
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
Adam,
Try this code.
I think this should do it.
Message was edited by: Leandro Cardoso Hand something wrong in there.. fixed it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Man.. that will be a lot of manual work, when the UI5 table will do most of the work for you.
Do you get any error when running chrome with the console mode?
Does at least the structure of the table appears?
Try this..
Best
Leandro
There were no errors in chrome and I also got the structure of the table, with some data( out of the first member )
....
var oColumn = new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: value.text}),
template: new sap.ui.commons.TextField().bindProperty("value", "/members/0/key"),
sortProperty: "/members/0/key",
filterProperty: "/members/0/key",
width: "100px"
});
oTable.addColumn(oColumn);
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData({dimensions: meta_data.dimensions});
oTable.setModel(oModel);
oTable.bindRows("/dimensions");
....
I won't work with sapui5, because you cant use col/rowspan-> but I need it for the results and measures.
So my decision is just to extend the "simplecrosstab" example in the ds_sdk
Regards
Adam
User | Count |
---|---|
68 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.