Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Dec 15, 2016 at 02:26 PM

    no need to destroy view, just bind the context again

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 15, 2016 at 10:21 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on 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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.