• Jeremy Kong
    May 24, 2016 at 8:53 am #1885

    Within a coach view, I’m trying to do this in the Event section for when a user selects a record for a service data table:

    this.context.binding.set(“value”,${Service_Data_Table1}.getSelectedRecord());

    This doesn’t work, but when I put it in an inline javascript function like below, it works.

    var thisview = this;
    var selectedRecord = thisview.ui.get(“Service_Data_Table1”).getSelectedRecord();
    this.context.binding.set(“value”, selectedRecord);

    Is there some notation that works? Is there way to address the context.binding in an Event for a control?

    SPARK Support
    May 24, 2016 at 10:48 am #1886

    Hi Jeremy,

    The issue is when trying to set something in the “Events” section of the control, the syntax would be (me.context.binding…..etc).  If you wanted to use “this” you would have to define what “this” is (ie.. var this = page.ui.get(“controlId”).

    I hope this helps if you have any more questions feel free to reach out.

    Jeremy Kong
    May 24, 2016 at 11:10 am #1887

    What if this is the Coach View itself. There isn’t a controlId for coachview, or is there? Any way to navigate up the tree? like me.parent()…

    SPARK Support
    May 24, 2016 at 12:28 pm #1888

    If it’s in a CV than you would have to use the latter syntax and define “this” in the inline JavaScript.

    For the second question it would be (me.ui.getParent(“controlId”);).

    Jeremy Kong
    May 24, 2016 at 1:47 pm #1890

    So to clarify. I have the inline javascript function working fine. I’m just looking to see if I can put it in the Events section instead of the inline javascript. Since I’m in the Event section, “me” would refer to the the Service_Data_Table1. How do I refer to the overall Coach View from the Event section? Is there a way to do that? or is that not recommended.

    SPARK Support
    May 24, 2016 at 2:32 pm #1891

    If I’m understanding correctly the only way to do this in the Event section would be to declare a function in the inline javascript then on the events call your function using (me.ui.invoke(fn,….).

    If this isn’t the end result your looking for can you please attach some screenshots so we can better understand your problem.  Also you can find the article on all the methods that SPARK uses to call functions in the event section here.

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

You must be logged in to reply to this topic.

Start typing and press Enter to search