I've got a problem in my (SAP)UI5 application. It occurs when opening the first item in a list in the Master view.
The flow is like this:
- User clicks on item
handleClick
function is calling an oData service to lock the item in the database- A callback with the
nav.to("Detail")
function is handed to the lock function - When the lock was successful, the callback is executed
- Now, the
onNavigation
event is triggered where we usebindElement
to expand the line items data of the detail view, which is omitted in the master - When the detail is rendered everything appears to be fine, but very shortly after it finishes the screen flashes and the detail is rendered again
- This time the line items are duplicated as seen in the following screen
I also use a formatter for the dates, and the dates are not shown. I learned that the formatter is called twice. The value handed to the formatter is empty after the first call and contains the date after the second call.
I think that's related to the same issue, but I'm not sure yet.
The master is bound to the base service url in the Component.js, with appView.setModel(dataModel);
. In the onNavigation
function of the detail controller, the following code is used:
onNavigation: function(context) {
this.getView().bindElement({
path: context.sPath,
parameters: {
select: "Id,Lifnam,Rmwwr,Waers,Sendedatum,Workflowtyp,Sktodat,Stufe,MonFrgstA,Bukrs,Belnr,Gjahr,EdcObject,BstatTxt",
expand: "Positions"
}
});
},
The table in the detail view is starting like this:
<Table
headerText="{i18n>LineItemTableHeader}"
items="{Positions}" >
<columns>
<Column>
And the rendering error is only happening for the first item in the master list, but not for every item either. And I'm not able to find any meaningful connection between the items, that could describe this error.
The oData service doesn't look corrupted:
I would be happy about any hint what could go wrong here. Thank you in advance.
Edit: Together with a colleague I just learned that it could have to do with the $count variable which is used by the oData service.
Here a screenshot of the Network tab of the dev tools:
The $count value is not bound to the positions here, instead it's connected to the number of items in the master list. I guess that should be the problem, but I'm still waiting of confirmation from my team mate.