Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to communicate an event from a sub view back to the parent view?

In a previous discussion I asked about how to swap out 2 separate areas in my application on the same page.

A poster (I think it was Andreas) suggested instead of using OverlayContainer (which either relies on a Shell or covers up the entire iFrame which was not good since I can't cover up a banner) that I just do this in 2 DIV's.

So I have one XML view that contains these 2 DIV's. The first DIV is the main one.

In the second DIV I was able to "include" another XML view (using the XMLView tag and giving it the view name) which is pretty cool.

The only thing is that in that second DIV's XML view there is a close button and I need to be able send an event from that view's controller back to the first DIV's controller so it can show the first DIV and hide the second DIV.

I tried to access them by doing this in the second DIV's controller but it did not work:

this.getView().getParent().byId("firstDIV");

Thanks,

Erich

Tags:
Former Member
Former Member replied

It could be that "this" does not refer to the controller whose method that is, but the other controller. Can you get reference with

var myContent = sap.ui.controller("namespace.Controllername").getView().byId("myContent");



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question