Results 1 to 2 of 2

Thread: Best practice using custom stateful components

  1. #1
    Ext Premium Member Jan (HL)'s Avatar
    Join Date
    Aug 2010
    Location
    Germany
    Posts
    111
    Answers
    1
    Vote Rating
    9
      0  

    Default Best practice using custom stateful components

    Hi,

    after upgrading from Ext JS 3 to Ext JS 4 I've noticed a difference of the applyState calls. It seems that applyState will called after initComponent but before render. However, this is fine. But it "destroys" (because this.el is not defined, this.rendered is false), the old easy behavior of a simple button.toggle, checkbox.setChecked and so on. (Use cases: Save button state, save checkbox state, save field value, and so on).

    So, as a workaround we can easily wrap the applyState-stuff with a single timed afterrender event or, for example just change the button.pressed state and fire the specific custom change event by myself.

    After all, I'm looking for a Best Practice / You-should-do-it-in-that-way solution which does not break anything I'd perhaps forgotten.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,268
    Answers
    3990
    Vote Rating
    1468
      0  

    Default

    Best practice... it's really whatever works for your application. I would probably go with adding an afterrender listener that will remove itself.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

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