1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    21
    Vote Rating
    0
    Forza Bo is on a distinguished road

      0  

    Default Rendering a progress window

    Rendering a progress window


    I am trying to give the user some feedback during a potentially lengthy initialization operation in my app. (Basically I have to perform a bunch of math on each record in a store...)

    So -- what I want to do is throw a window with a progress bar, update the bar as each record is iterated, and then close the window. This is how I would expect to do this -- except the window never renders. I guess rendering is deferred until the function finishes execution?

    Code:
     var progressbar = Ext.create('Ext.ProgressBar',
                    {
                    width: 280,
                    text: 'initializing egus'
                    });
                var win = Ext.create('Ext.window.Window',
                    {
                    title: 'Initializing Egus',
                    id: "init_window",
                    modal: true,
                    height: 50,
                    width: 300,
                    layout: 'vbox',
                    items: [
                            progressbar
                           ]
                    }).show();
                var egus = me.getEgusStore();
                egus.each(function(egu){
                    me.setMarginalCost(egu);
                    progressbar.updateProgress(100.0/egus.getCount());
                    });
                win.close();

  2. #2
    Touch Premium Member
    Join Date
    Mar 2011
    Posts
    120
    Vote Rating
    7
    chamacs is on a distinguished road

      0  

    Default


    Does this work when run after you update the progress?

    Code:
    progressbar.doComponentLayout( );

  3. #3
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    each() is too quick so window is shown then closed immediate.
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Posts
    21
    Vote Rating
    0
    Forza Bo is on a distinguished road

      0  

    Default


    Quote Originally Posted by chamacs View Post
    Does this work when run after you update the progress?

    Code:
    progressbar.doComponentLayout( );
    nope.

    each() is too quick so window is shown then closed immediate.
    no -- the routine takes as much a few minutes. And I have tried replacing 'each()' with a simple for-in iteration, makes no difference.

    It seems like rendering only occurs when the script is in a kind of idle state...

    I've tried firing the initialization function from a timeout, and also from an afterrender listener for the window. I can get the window to appear, but the progress bar does nothing...

  5. #5
    Sencha Premium Member
    Join Date
    May 2010
    Location
    Guatemala, Central America
    Posts
    1,266
    Vote Rating
    80
    ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough ssamayoa is a jewel in the rough

      0  

    Default


    It seems like rendering only occurs when the script is in a kind of idle state...
    Sounds reasonable so, what about starting your record processing in the show event of the window?
    UI: Sencha Architect 3.x / ExtJS 4 & 5
    Server side: JEE / EJB 3.x / CDI / JPA 2.x/ JAX-RS / JasperReports
    Application Server: Glassfish / WildFly
    Databases: Oracle / DB2 / MySQL / Firebird

    If you like my answer please vote!

Thread Participants: 2