Search Support
-
Andrzej MichalecOctober 5, 2016 at 2:20 am #2815
In SPRAK UI toolkit (4.4.3 TRIAL) I have an issue with passing parameters to custom function when widget/control is injected (using @function syntax). Your documentation does not specify such case explicitly but I see this behaviour as obvious shortcoming.
Example — parent coach view has inline javascript with this function definition:
this.doSomething = function(widget, param) {
...
}
Then onLoad handler for SPARK widget tries to call that function as follows:
@doSomething("someValue")
Inspection shows that arguments are being replaced with the only widget instead injecting widget reference and shifting arguments in array which would be more intuitive.Note that I can achieve expected behaviour calling
me.ui.getParent().doSomething(me, "someValue")
but @function makes handler nicely short so treat my message as enhancement suggestion.regards,
-andySPARK SupportOctober 5, 2016 at 10:48 am #2818Hi Andy,
Thank you for the feedback and the Enhancement suggestion.
If the function is defined within the same Coach View, you can use function(parameters) without the @ symbol to pass arguments. There is also a method for me.ui.invoke(“function name”, “arguments”) that can be used to invoke a function with arguments.
Regards,
Stephen P.
Andrzej MichalecOctober 6, 2016 at 4:30 am #2819For my function defined on CV level (inline javascript, this.doSomething = function(params)…) using ‘doSomething(params)’ without @symbol results with ReferenceError: doSomething is not defined. However the second way of me.ui.invoke() works fine, thank you for that tip, it is less error prone than reaching out for CV thru parent hierarchy I tried by ‘me.ui.getParent().doSomething(me, params)’.
SPARK SupportOctober 6, 2016 at 6:58 am #2821Hi Andrze,
I’m glad that worked for you.
Regards,
Stephen P.
-
|
You must be logged in to reply to this topic.