on ‎2017 Aug 25 1:17 PM
Hi Experts,
I have implemented a very simple app for testing purposes with a simple responsive table containing Usernames and E-Mail Addresses:

The controller logic is very simple, too. It just contains the button event handlers.

The table data is coming from an ABAP Back-End and I used an Odata Model with Two-Way binding to bind the list. When updating single properties of the existing lines (e.g. E-Mail Address) the Back-End update works fine. My Save Button Event handler simply submits all changes (see listing above). Now I want to add several lines at once and submit them all together. No Record in the back-end can be created before at least the key field "Username" was entered by the user. When pressing the "Add" button my logic actually adds new lines:

When I enter new data in these new lines and submit the changes everything is persisted correctly. But: If I apply any changes to the old lines (originally coming from the BE) the lines vanish. I did some debugging and the model update caused by the changes of the existing lines triggers a refresh of the list binding of the table. All table lines that did not come originally from the BE are removed. The same happens when I change the odata service to One-Way Binding and I call any setProperty Method at the model. So, it's not an issue with the Two-Way Binding.
Does anyone have an idea how to overcome this issue?
Regards
Tobias
Request clarification before answering.
To facilitate easier handling of data, load the oData data to a local JSON model.
Manage the local JSON model to add multiple entries. Validate user input and prepare the JSON which is to be updated to backend.
On Save, push the local JSOn model by passing it to the oData service which updates the data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sharath M G,
that was exactly my thought, too. I just didn't want to mention that in my initial post to maybe get different approaches. The main problem with that in my productive App (not the app I showed above) is that I am using a Smart Table control. It's heavily based on OData metadata and I am not sure if I can get it working with JSON Model. Moreover, this apporach can be quite cumbersome because I need to keep track of all changes. I exactly need to know which records were created/deleted/changed to know which OData Method needs to be called.
Regards
Tobias
directly adding a line to the table is not supported by odatamodel, if my memory is right.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 12 | |
| 9 | |
| 7 | |
| 5 | |
| 4 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.