Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Multi Re-Use component in single UI application.

ssrinivas
Product and Topic Expert
Product and Topic Expert
795
Hello Experts,

We are currently working with a UI5 application that serves as a reusable component for integration into other UI5 applications. The consuming applications can seamlessly incorporate our reusable component.Within our re-use component, we employ sap.m.Table, where in we use Stable-ID’s for the columns so it’s picked & used by Variant Management control (VM).

Works Fine:
If single instance of re-use component is implemented.

Does Not Work:
Facing issue when our consuming application try to implement multiple re-use component instance in single ui5 application (Single Page/View) under different IconTabBar container.

Error:
Duplicate ID issue for the columns. In for the re-use component.

Analysis:
  1. The component always generates runtime ID’s like “_Component0” ,  “_Component1"  etc. So we cannot rely on this ID in the consuming application.
  2. We are unable to fetch any context for setting standard ID to the component.
Many Thanks,
Srinivas
5 REPLIES 5

rahullohia
Product and Topic Expert
Product and Topic Expert
0 Kudos
554

Hi Srinivas,

I have a similar issue where the re-use component initializes with a stable id. Hence, we cannot have multiple usages of the same. Were you able to resolve this issue?

Thanks,

rahul

ssrinivas
Product and Topic Expert
Product and Topic Expert
0 Kudos
304

Hi Rahul,

@rahullohia 
I don't have a solution yet, but I'm currently trying to get in touch with the Component Control team. I'll update the POST as soon as I have more information.

By any chance, have you come across any alternative approaches in the meantime?

Best regards,
Srinivas

rahullohia
Product and Topic Expert
Product and Topic Expert
0 Kudos
249

Hi Srinivas,

Unfortunately, I had to change the design wherein I am using the same component instance twice using a switch.

Maybe you can try this approach instead of manually creating the views/controller where the component is initialized?

https://help.sap.com/docs/ABAP_PLATFORM_NEW/468a97775123488ab3345a0c48cadd8f/d869d7ab3caa48b2a20dc20...

Thanks,

Rahul

ssrinivas
Product and Topic Expert
Product and Topic Expert
0 Kudos
184

Hello Rahul,

Thanks for sharing the info.
I tried adding the autoPrefixId="true" property and i was able to fetch these id's in the consuming application. 

 

<core:ComponentContainer
        id="comp1"
        usage="someComponent"
        manifest="true"
        async="true"
        autoPrefixId="true"
    />

 

 Inside Component.js of consuming application,try checking the value in onBeforeRendering.

onBeforeRendering: function(){
  console.log(this.getId()); 
}

ssrinivas
Product and Topic Expert
Product and Topic Expert
0 Kudos
133

This works just for standalone application. When integrated to FLP the getId() doesn't work