cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

junwu
Active Contributor
0 Kudos

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