Results 1 to 2 of 2

Thread: Best practices for configuration option that is an array?

  1. #1
    Ext JS Premium Member
    Join Date
    Oct 2010
    Posts
    103
    Vote Rating
    7
      0  

    Question Best practices for configuration option that is an array?

    I am porting a couple of applications and libraries over to ST2, and am really liking what I see. I have run into a bit of a question on the configuration system though. I have a custom component that is configured with a list of item configurations. I am not sure how to handle array values.

    Are their any recommended best practices for configuration options that are arrays?

    For example when adding an item to an array, it seems like you would call getMyItems() and then call push on it, but this would skip all the infrastructure for apply and update methods. How should this be handled with the new configuration system?

    Also, in the previous class I had to initialize my configuration item list with a value of null to make sure it didn't get reused (ie. shared) across class instantiations. Is this handled automatically by the configuration system now, or do I need to do something explicit to make sure that default values don't get shared across multiple instances?

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

    Default

    For items, if you want to add an item anywhere you can use the add/insert method. For custom ones, you can push to the array but I would then execute the set method with that new array. Then in the apply or update method you can take action on that array.
    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.

Tags for this Thread

Posting Permissions

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