Results 1 to 6 of 6

Thread: Adding fields to a model

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    9
    Vote Rating
    0
      0  

    Default Adding fields to a model

    I've got a model where most of the fields' values come from an ajax proxy. However, I want to add a few more fields that are processed by the app. Is there an elegant way to do this within the model's definition? Like having a conversion function that takes the data from a field and stores the result in a new field (not overwriting the original one). I created the method but don't know where to call it from.

    Thanks

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Vote Rating
    1297
      0  

    Default

    You should have your fields defined upfront.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    625
    Vote Rating
    39
      0  

    Default

    Override the model's editEdit() function and populate the fields that your proxy didn't.

  4. #4
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    87
    Vote Rating
    1
      0  

    Default

    you could use the convert function as suggested here http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Field
    under "types and conversions". hope this helps

  5. #5
    Sencha User
    Join Date
    Feb 2013
    Posts
    10
    Vote Rating
    -1
      -1  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    You should have your fields defined upfront.
    what is this for crap answer!
    if you don't feel like answering in a polite manner then please say nothing!

  6. #6
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,326
    Vote Rating
    1297
      0  

    Default

    Quote Originally Posted by coloenz View Post
    what is this for crap answer!
    if you don't feel like answering in a polite manner then please say nothing!
    Don't see how this is a non-polite answer. Did you read some sort of tone in this text that isn't there?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Posting Permissions

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