Skip to Content
0

​SAP UI5 data binding sap.m.table

Sep 01, 2017 at 12:38 PM

146

avatar image
Former Member

Hello Everyone,

Request your help on below problem statement:

I am using sap.m.table for UI. The desired format is as attached.

The links in details columns are coming in a string format separated using delimiter.

I am binding data dynamically on my page using bindAggregation and a template. I need help on how can I bind data for Details column.

Points to be taken care of:

  • Count of text and links pair should come dynamically.
  • Thus multiple link items have to be created corresponding to a single row.
  • On click of a row I need values from row to fetch exact URL.

Note: The format or patterns of Details column can be altered in back end but they will come in single field(single row).

Regards,

Minakshi

ui5-scn.png (6.0 kB)
ui5-scn.png (6.5 kB)
10 |10000 characters needed characters left characters exceeded

Minakshi,

what code have you tried?

here is the link to the documentation of the sap.m.Table control https://sapui5.netweaver.ondemand.com/#/entity/sap.m.Table

then within the table, on your template you may need a text formatter function as shown here

https://sapui5.netweaver.ondemand.com/#/sample/sap.m.tutorial.walkthrough.23/code/webapp%252Fmodel%252Fformatter.js

0
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member
Sep 03, 2017 at 01:09 PM
1

You can instead use a factory function while binding where you can get the string data from the model and split it using the delimiter to get an array.

Then you can create the content dynamically in the function and return a layout control which has these items as an aggregation.

You can look at the links below for the factory function

https://sapui5.netweaver.ondemand.com/sdk/#/topic/335848ac1174435c901baaa55f6d7819

https://sapui5.netweaver.ondemand.com/sdk/#/topic/284a036c8ff943238fb65bf5a2676fb7

https://sapui5.netweaver.ondemand.com/sdk/#/api/sap.ui.base.ManagedObject/methods/bindAggregation

Share
10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay Sep 02, 2017 at 06:56 PM
0

Hi,

you can use formatter function to format and put the count, check below example,

Example in fiddle

and i think you can get row value on row selection event further.

Share
10 |10000 characters needed characters left characters exceeded
Sharath M G Sep 02, 2017 at 06:07 PM
0

When you bind the aggregation dynamically, use a local model to bind the data to your rows.

Populate the model, with the data you need to see on the table. Since it is data bound to control, you can have a separate method where the model is populated and it will be respectively updated on the view.

Regards,

Sharath

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Mar 28 at 06:40 AM
0

Hi,

Add controls to the cell after u get data for the table.

Use HBox, VBox layouts to alight multiple value in same column.

Regards,

Gururaj

Share
10 |10000 characters needed characters left characters exceeded