Hi Christopher,
what you can do to achieve this behaviour is to use a ComponentContainer widget as template item for the grid’s content aggregation and bind the aggregation to some data source that will copy the template as often as is needed, i.e. if you’d use a collection variable as data source and the array contained 3 elements, the ComponentContainer would be copied 3 times as well. Subsequently, you can load the module inside all these generated ComponentContainers via script (either Script activity inside your process story or a client-side Business Object function) and optionally send data to the module via interface calls. You can extract and adapt the needed script code from the ‘Code’ section as can be found in the tab ‘Others’ in the Application Editor when you add a module setup shape to any process story and hit deploy. I will include an exemplary code snippet for you below in any case, of course you would still need to iterate over all created ComponentContainers beforehand and add their respective IDs to all lines referencing the widget ID:
var sModuleName = “myFancyModuleName”;
var cbForModuleLoad = function(data, optArg) {};var oContainer = sap.ui.getCore().byId(“MyModuleScreenId–ui_core_ComponentContainer_MyModuleContainer”);
if (!oContainer) {
console.error(“No ComponentContainer with id MyModuleScreenId–ui_core_ComponentContainer_MyModuleContainer found”);
return;
}
try {
var oOneTimeDelegate = {
onBeforeRendering: function(oEvent) {
this.Modules.addModuleContainerRelation(sModuleName, “MyModuleScreenId–ui_core_ComponentContainer_MyModuleContainer”);
this.Modules.getSubscriptionsForModule(sModuleName).forEach(function(oSub) {
sap.ui.getCore().getEventBus().subscribe(oSub.channel, oSub.event, oSub.listener, this);
}.bind(this));cbForModuleLoad.call(this, oEvent);
oContainer.removeEventDelegate(oOneTimeDelegate);// publish to module interfaces if needed
var dataFormyFancyModuleName_myModuleInterfaceName = {};
dataFormyFancyModuleName_myModuleInterfaceName[‘myModuleInterfaceParameterName’] = “myModuleInterfaceParameterValue”;
sap.ui.getCore().getEventBus().publish(“AppTomyFancyModuleName”, “myModuleInterfaceName”, dataFormyFancyModuleName_myModuleInterfaceName);}.bind(this)
};oContainer.addEventDelegate(oOneTimeDelegate);
this.Modules.getDependenciesForModule(sModuleName).forEach(function(oDep) {
jQuery.sap.registerModulePath(oDep.name, oDep.url);
});
oContainer.setSettings({
componentData: {
loadedBy: this.getApplicationName()
}
});
oContainer.setUrl(SimplifierSettings.getModulePath(sModuleName));
oContainer.setName(sModuleName);} catch (e) {
console.error(e.toString());
}
Hope this helps. Kind regards,
Armin