-
7 Feb 2013 10:04 AM #1
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();
-
7 Feb 2013 10:42 AM #2
-
7 Feb 2013 10:54 AM #3
each() is too quick so window is shown then closed immediate.
UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
7 Feb 2013 1:18 PM #4
nope.

no -- the routine takes as much a few minutes. And I have tried replacing 'each()' with a simple for-in iteration, makes no difference.each() is too quick so window is shown then closed immediate.
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...
-
7 Feb 2013 1:21 PM #5
Sounds reasonable so, what about starting your record processing in the show event of the window?It seems like rendering only occurs when the script is in a kind of idle state...UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!


Reply With Quote