Tina Chen
Tina Chen

Reputation: 2030

How to implement new item of sap.m.Table in Fiori?

I want to implement new item(row) in sap.m.Table. In Add Items section of Fiori guideline, it looks like this:

enter image description here

Here is my Demo

I have three questions:

  1. How to add the new row to the first item of the table?

  2. How to "highlighted it with a visual indicator"? (the left blue part in design)

  3. Why addOneRow function did not work before setModel? Is it because data binding refresh the table or sth.?

Upvotes: 0

Views: 274

Answers (1)

Ji aSH
Ji aSH

Reputation: 3457

1- The way I addressed this problem in several project is by using 2 tables : first tables only contains one fixed row and the second one is binded to an array. When clicking the 'add' button in the first table it resets the first table content and adds an item to the second table binding

2- the hightlight property is on the items. example:

<ColumnListItem type="Detail" highlight="Error">

if you use my solution from #1 you might use it only on first table

3- you're totally right, this is also why you should put your 'addOneRow' in the 'onAfterRendering' callback to make sure your last row (that you likely always want) is always displayed. (btw if you use solution from #1 you simply dont need it anymore)

Upvotes: 1

Related Questions