1. #1
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default Initialization in View

    Initialization in View


    Hi,

    In the View javadoc it is said :
    Code:
      /**
       * Called once prior to handleEvent being called. Widgets should be
       * instantiated in the init method rather than the view constructor.
       */
    Why is it suggested to instantiate widgets in the init method rather than in the constructor ? Is it because some widgets constructors are making some rendering work ?

  2. #2
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    Maybe an answer :
    Suppose you have a controller which has a lot of views. The first time the controller handles an event, the intialize() method is called. If all your views are instantiated in the initialize() method and you instantiate the widgets in the View constructor, then all the widgets of all the views will be instantiated (instead of being lazily).

  3. #3
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    Thoughts ?

  4. #4
    Sencha User
    Join Date
    Nov 2007
    Posts
    38
    Vote Rating
    0
    mraible is on a distinguished road

      0  

    Default


    I believe the current setup makes sense as it allows you to build your view (with LayoutContainers and such) and use your Controller to populate it's data. The data might change, but the view construction is unlikely to.

  5. #5
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    You're right.
    Anyway, even if you instantiate widgets in the initialize() method rather than constructor : once the widgets are instanciated, they will never be removed from memory.
    If you create new widgets on each app event, they will not be kept in memory.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar