Skip to Content
S G

Model Sharing between different apps

Hi Experts,

My requirement: JsonModel/Model sharing between multiple BSP apps.

BSP 1 named as Parent App

BSP 2 named as Child App

I am able to call the model from child to parent app and vice versa by using eventbus.

I have a couple of doubts :

  1. can we use this eventbus(model sharing between apps) in production level?
  2. Are there any disadvantages and advantages by using eventbus
  3. Is it possible if the huge amount of data(more than 50,000 records) transfer between apps by eventbus?

Thanks in advance.

Regards,

SG

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Aug 22, 2018 at 09:27 AM

    You can pass any data to your child app within componentData, when you create your Component like this:

    var oComponent = sap.ui.getCore().createComponent({
    	name: "your.namespace.ChildApp",
    	id: "ChildApp",
    	componentData: {
    		oJSONModel: oYourJSONModel
    	}
    });
    var oComponentContainer = this.getView().byId("idComponentContainer");
    oComponentContainer.setComponent(oComponent);
    

    In your child app component.js read oJSONModel like this:

    var oComponentData = this.getComponentData();
    var oJSONModel;
    if(oComponentData && oComponentData.oJSONModel){
    	oJSONModel = oComponentData.oJSONModel;
    } else {
    	// Fallback, if parent app passes no JSONModel
    	oJSONModel = new JSONModel();
    }

    Parent and child app are working on the same model now.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 21, 2018 at 01:25 PM

    event is not meant for data passing, I think.

    I don't know how you integrate two ui5 app, reuse component? there are different ways, you can use sap.ui.core to share data

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Jun Wu,

      I used the component container to integrate two bsp apps. and to achieve my requirement I used eventBus and I got success in sharing data between two apps.

      but my doubt eventbus is the right way to do? are there any disadvantages.

      Regards,

      SG

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.