Results 1 to 2 of 2

Thread: on(load) function

  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    8

    Default on(load) function

    Hi,
    Is it possible to find the exact moment when a component is finished loading?
    I create an Ext.Window, and then need to 'do stuff', but it is vital to wait until the window and its components (panels and charts) are finished loading.
    I thought something like the following might work, but nothing is happening:
    Code:
      mywindow.on('load', function() {
                                        console.log('window LOADED!');
                                        }
                             );
    For the record, my window is defined as follows:

    Code:
    mywindow = new Ext.Window({
                        height: 600,
                        width: 800,
                        closeAction: 'hide',
                        layout: "anchor",
                        items: [panel1,panel2, panel3],
                      });
    I have a pretty unsatisfactory temporary work-around, independent of the window loading, by using a timeout:
    Code:
    setTimeout(function(){ 
                                       //do stuff
                                       },1250);
    I would really like the application to 'do stuff' as soon as the window is ready to go, instead of just waiting an arbitrary amount of time. The window might not even be ready by the end of the timeout in some cases, so that would mess things up!
    Any suggestions?
    Many thanks,

    Eoin

  2. #2
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335

    Default

    Hi,

    You can use afterrender event or show event of ext window like:

    myWindow.on('show', this.onWindowShow,this);

    It depends what you want to do.
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

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
  •