Skip to Content
0
Jul 21, 2014 at 01:49 PM

Design Studio 1.3 SDK - Are script contributions for SAPUI5 method functions supported?

68 Views

All of the SAPUI5 SDK component examples provided with the Design Studio Samples demonstrate how to expose property getter/setter functions as script contributions. Indeed, the SDK Developer Guide also just focuses on this. However, UI5 controls may also include method functions that allow certain actions to be performed on the control. In this context, I have the following questions:

1) Is it possible to expose method functions via script contributions in the contribution.ztl file? If yes, what is the correct syntax for doing so? Based on my experimentation so far, it seems like method functions cannot be exposed directly via script contributions;

2) If method functions are not supported for script contributions, are there any recommended approaches as a workaround? One possible approach that comes to mind is as follows:

i) Define an invisible "dummy" property of type boolean to correspond with each method function that we want to expose as a script contribution;

ii) Define invisible properties to correspond to the parameters required by the method functions;

iii) In the contributon.ztl code, perform the following tasks:

(a) Set the invisible parameter property values that correspond to the desired method function;

(b) Invoke the dummy property getter or setter function by getting or setting the boolean value of the dummy property in the contribution.ztl code;

iii). Override the corresponding dummy property getter or setter function in the component.js code with additional logic to read the invisible parameter property values and then call the method function.

Any feedback would be appreciated.

Thanks,

Mustafa.