Results 1 to 6 of 6

Thread: Best Way to load data for a form

  1. #1
    Sencha User
    Join Date
    May 2008
    Location
    Anrath - Germany
    Posts
    168

    Default Best Way to load data for a form

    Hello,

    I display my forms in a window.
    When I display a window containing a form I would like to load the data for this form.
    What is the best way to do this? I can't use onRender(), because when i display the form a secound time, the form is not rendered then...

    Thanks for your Help,
    Urkman

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    Code:
    <your form>.getForm().setValues(<your data object>);
    If your form inputs have a name property, setValues will map the values from the object.

  3. #3
    Sencha User
    Join Date
    May 2008
    Location
    Anrath - Germany
    Posts
    168

    Default

    Hello CrazyEnigma,

    thanks for your answer, but this was not what I was looking for. I think my question was wrong:
    I'm looking for "when" not "how" I load the data into my form...

    What is the best event to listen to and what is the best way to implement the listener?

    I tried the "show"-event, but it never get's fired. But perhaps I'm doing something wrong...

    Thanks,
    Urkman

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    The event will get fired if the form is shown and hidden.

    But its up to you . When do you want to load it???

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Post

    Post your show event code. Are you showing the window and hiding it or destroying the window each time?

    The show event should fire, but maybe you are losing scope.

  6. #6

    Default

    Basically, just before you show your form, you need to load the data into it. Then, when the "OK" button is pressed, you put it back.

    Didn't take me long to spin-off a base class to do this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •