cancel
Showing results for 
Search instead for 
Did you mean: 

Detail view does not reload when a new item is clicked in the master view (SAPUI5)

Former Member
0 Kudos

HI I am working on a split App where I am having a list of business partners in the master view which when clicked displays the details in the Detail View. It works well for the first partner clicked but remains as is when we click any other partner in the master list.

I am using the below code in my master controller onclick event to navigate to the detail view on click of the partner number.

1. var context = oEvent.getSource().getBindingContext(); 
2. this.nav.to("Detail", context);

During the first click, i observe that after statement 2, the detail controller is being called which renders the entire detail view and so we get the data, but on the next click, the statement 2 doesn't re-render the detail view as it already exists and so the data isn't being reloaded.

I tried manually reloading the detail view, destroying it and none of them worked.

var oView = sap.ui.view({
       viewName: "sap.ui.demo.MyFiori.Detail",
           type: sap.ui.core.mvc.ViewType.XML
)
oView.destroy();

Can someone please give me a solution for this.

Accepted Solutions (0)

Answers (3)

Answers (3)

junwu
Active Contributor

no need to destroy view, just bind the context again

Former Member
0 Kudos

I just tried destroying to see if is solved the issue, otherwise i am just doing the below in the on click method.

1. var context = oEvent.getSource().getBindingContext(); 
2. this.nav.to("Detail", context);

Should i be doing a setBindingContext() after the nav.to?

SergioG_TX
Active Contributor
0 Kudos

agree with Jun - only bind the context without having to destroy the view.