cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Table

Former Member
0 Kudos

Would like to ask about the best way to do an update of table data

Scenario:

  1. Table is binded using JSONModel
  2. Number of rows showed is 10
  3. Requirement is to provide a sync/update button which update at one go all the change data
    1. Which could be anywhere in the table (different row different cell)

I am able to update the table properly only based on the 10 rows due to the API provided by SAPUI5 for table, which is getRows (which seems to be only returning the rows that are currently in the DOM element / end user is viewing). So if I have data changes in rows that outside of the current 10 rows being viewed, there does not seem to be an API for me to make use of.

Would be glad that someone could help me out

Accepted Solutions (1)

Accepted Solutions (1)

saivellanki
Active Contributor
0 Kudos

Hi Beck,

I don't know which control you're using in the table cell for editing values.


Here is an example using TextField control in table which has change event. When user edits value in the column 'Name' for any row and hit enter, it catches the new value and updates in the model for that specific binding context path. You can store all the updated values in a new model and send only those values.

Plunker - Table Model Updation

Regards,

Sai Vellanki.

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

Hi Beck

When you update the model then the table will be updated.

Thanks

-D

Former Member
0 Kudos

Hi Dennis,

Yup, when I update, the JSONModel will be updated. But because I will need to update the database with the new values, what I would like to achieve is know specifically which data has been updated and only send those back to the database rather than sending the whole model back.

Example.

JSONModel = 30 items array

Table row show = 10 items only

End user updated items = [1, 2, 10, 12, 15, 22] (this are the data which I wish to send back to the database via rest call instead of sending the whole oModel)

former_member182862
Active Contributor
0 Kudos

HI Beck

Does this JS Bin - Collaborative JavaScript Debugging sheds some lights?

-D