Get datas back from a modal

Home Forums Convertigo Products Get datas back from a modal

This topic contains 1 reply, has 2 voices, and was last updated by  mermaidlittle221@gmail.com 1 week, 1 day ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #255991

    Alexandre Perret
    Participant

    Hello

    I need to get datas back from a modal page into the parent page.
    Please how to do it ?
    (I used a modalAction to call a page in a modal)

    Thank you

    #255992

    Gregory Vorbe
    Moderator

    Hello Alexandre,

    With the minimum code writing and only using available Mobile Palette components, I would suggest you use to create a ‘setGlobal’ component in your parent page like:

    Property = myModalVars
    value = {} (TS)

    on a ‘onDidEnter’ pageEvent component, for example.
    Then, in your Modal page, add a ‘CustomAction’ component as parent of a ‘CloseModal’ component (if values passes your control validation or if user clicked an ‘OK’ button, for example) and write in it:

    this.global.myModalVars.myData1 = myValue1;
    this.global.myModalVars.myData2 = myValue2;
    etc...

    In your parent page you will have the fresh new data like:

    this.global.myModalVars
    => {"myData1": myValue1,"myData2": myValue2, etc...}

    myModalVars is global for every pages.
    If you want a local variable for your page only, edit page class (right-click on the Page name) and add your variable between

    /*Begin_c8o_PageDeclaration*/
    public myModalVars = {};
    /*End_c8o_PageDeclaration*/

    When calling your modal page, set ‘Page data’ property to this.myModalVars in TS mode.
    In your modal page, populate variable using
    this.myModalVars.data1 = myValue1;

    QA&Support

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

You must be logged in to reply to this topic.