Skip to Content
0

Reuse View 2 of App 2 in View 1 of App1

Oct 17, 2016 at 12:28 PM

77

avatar image
Former Member

Hi All,

I have 2 applications in my fiori launchpad:

App1 which has View 1

App2 which has View 1 & View 2.

In the View1 of App1 I have Icon Tab Bar and on the click of the Icon Tab I want to load the View 2 of App2. Meaning I want to embed/reuse the same xml view of App2 in App1,

Please note:

So far, I have tried 2 approaches:

  1. var oComp = sap.ui.getCore().createComponent( {

name : "hc.pe.manageaccounts",

id : "Comp4",

url : "/hcpemanageaccounts",
componentData : {

"targetViewName" : "CreateUser"

}

});

this.oCompContainer = new sap.ui.core.ComponentContainer("oCompEdit", {

component: oComp,

propagateModel: true,

height: "50%"

});

this.oCompContainer.placeAt(this.getView().byId("id"));

https://archive.sap.com/discussions/message/16627714#16627714

This approach, give me the component instance.

2. Using the "resourceRoots", in the manifest.json: THis approach only searches the local resources folder of the current application.

3. I also tried, registerResourcePath and jquery.sap.require,but could not get the solution.

Any help will be highly appreciated.

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

1 Answer

Best Answer
Ryan Crosby Oct 20, 2016 at 01:51 PM
0

Hi Priya,

I have done something like this in some prototyping and the only thing I had to do was do call registerModulePath("some name", "server path") in the Component.js file where I want to add the view from the other application. Then in the init function of the controller I create the component and place it into the view like so:

var component = sap.ui.getCore().createComponent({
                name: "some name"
            });
            var oCompCont1 = new sap.ui.core.ComponentContainer({component: component});
            oCompCont1.placeAt(view.byId("somePage"));

Regards,

Ryan Crosby

Share
10 |10000 characters needed characters left characters exceeded