• Andrzej Michalec
    October 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:


    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.


    SPARK Support
    October 5, 2016 at 10:48 am #2818

    Hi 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.


    Stephen P.

    Andrzej Michalec
    October 6, 2016 at 4:30 am #2819

    For 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 Support
    October 6, 2016 at 6:58 am #2821

    Hi Andrze,

    I’m glad that worked for you.


    Stephen P.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search