Skip to Content
0

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

Dec 15, 2016 at 01:51 PM

84

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Jun Wu Dec 15, 2016 at 02:26 PM
2

no need to destroy view, just bind the context again

Share
10 |10000 characters needed characters left characters exceeded
Sergio Guerrero Dec 15, 2016 at 10:21 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Sri Rangarajan Dec 16, 2016 at 03:37 PM
0

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?

Share
10 |10000 characters needed characters left characters exceeded