Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table - add row dynamically, formatter issue

Hello Experts,

I'm having a table in my SAPUI5 application.

The table has an "Add Row" button in each row which supposed to insert a new row below the current row.

If I'm not using a formatter function it works but if I'm using a formatter there is a strange behavior, see screenshots:

1. Initial View

2. Added 2 (empty) rows

3. Enter values in the rows

4) When pressing the "+" I'm expecting that both "3" and "4" will go down but only "3" goes down.

jsbin:

http://jsbin.com/papata/1/edit?html,output

If I'll comment the formatter function it'll work.

What am I doing wrong?

Regards,

Omri

Table.jpg (140162 B)
Former Member replied

Hi Omri

I have fixed your code here. And few things

1. we are responsible to update the model if we have formatter. See the change handler that I have added

2. you do not need to bind model to table again once it is set in global. BTW, you have oTable.setModel(sap.ui.getCore().getModel("tblModel")); which is incorrect. It should be

oTable.setModel(sap.ui.getCore().getModel("tblModel"), 'tblModel') if you really wan to; Anyway, this is not need because UI5 will look it up in the global model.

Thanks

-D

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question