Skip to Content
avatar image
Former Member

getting duplicate id error in table when navigating in item list in master screen

Hi,

Am getting duplicate id error and table data hangs when navigating to item in master screen which has table in detail screen for which row is removed but not saved to backend.Am using odata binding in m.table.I have seen many example to remove selected row from table using splice function but this doesn't work for me since am using odata model.

error is:"Error: adding element with duplicate id '__icon0-__component0---detail--lineItemTable-0'"

Am using the below code to remove a selected row from table:-

deleteRow: function() { var oTable = this.getView().byId("lineItemTable"); var colLsit=this.getView().byId("lineItemColumnList"); var arrLength = this.getView().byId("lineItemTable").getSelectedContexts().length; var oItems = oTable.getItems(); if (arrLength > 0) { for (var j = oItems.length - 1; j >= 0; j--) { if (oItems[j].isSelected()) { oTable.removeItem(oItems[j]); } } } else { MessageToast.show(this.getResourceBundle().getText("selectitem")); } },

thanks for your time

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Mar 20, 2017 at 04:55 PM

    just delete the record through odata model, the row will be deleted automatically

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 21, 2017 at 07:47 AM

    Hi,

    We have a scenario based on the table rows data,there is calacuation based on which user can either save it or ignore and move to next item in master list.

    This error happens only when user move to othe item in master list without saving

    Thanks,

    Palani

    Add comment
    10|10000 characters needed characters exceeded