Skip to Content
author's profile photo Former Member
Former Member

UI5-Table + OData Server update approach

Let's say I have sap.ui.table.Table that I have bound to a ODataModel.srv/Products entity with thousands of rows. I added a few editable columns such as Name, PartNumber, Color, etc. A user updates a few rows (say rows 10, 100, & 200) while using filters and sorting so only a few rows are cached in the client. So what approach should I take to just sending just a few rows of changes ( e.g. 10,100,&200 or cells) up the server using a ODataModel update request???


I know that I could bind and attachChange listener to the ODataModel that fires when a setProperty has been executed by the table's column, but that event (to the best of my knowledge) does not tell me what row/cell has changed. So is there away to keep track of what cells have changed or does the odatamodel keep track of whats cells are changed such I can query for the changed cells? And the next questions, how should errors be handled if the if those updates are invalid and detected on the server?


Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 13, 2016 at 04:54 AM

    1. Attach event listener to the controls with in the row.

    2. When event is fired: get properties of that control and make odatamodel update request from event listener.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 13, 2016 at 11:41 AM

    Hey Joseph,

    I have already develop such a scenario for my firm so i think i can help you on this.

    One thing you can do is make the column initialy uneditable and place some button control within each row(yellow marked in screenshot), by attach event listener (attachPress) to that button and than you can get the index of the row whose button is clicked and only those indexes from the tabel array you can send to server to update.

    And answer to your second question: when you call the POST service for updating table on server side if the data is invalid and detected on server the same Error response you will get on the front end too you have to just place requestFailed event which will capture the error. Go through the doc of odata Model for error event: JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel

    I hope this might help you .

    Thanks


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.