Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 15, 2016 at 02:26 PM

    no need to destroy view, just bind the context again

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 15, 2016 at 10:21 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 16, 2016 at 03:37 PM

    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?

    Add comment
    10|10000 characters needed characters exceeded