PDA

View Full Version : Change message of a mask after its showing - may be progressbar



shahdollie
10 Nov 2010, 4:08 PM
Hi everyone

I want to change message of a mask after its showing. For example we show progress bar in flash to display percentage of loading.

I tried progress bar but its not updating its progresstext (i dont know why!!!)



Create:
var mask = Ext.Msg.progress("Importing Text", "Processing...", "Please wait...");

Update:
mask.updateProgress(number, text, "Processing...");

Close/hide:
mask.hide();

But if i use console.log() in method where mask.updateProgress is used, i get correct output....
What am I doing wrong????

Thanks alot for help
Regards

shahdollie
11 Nov 2010, 1:30 PM
hi everyone...

Any example that shows how to use progressbar...

I got this one but it has timeout....i dont want to set any timeout coz already my function takes alot time

http://www.java2s.com/Code/JavaScript/Ext-JS/ProgressBardialog.htm

Please help me...
Regards

shahdollie
16 Nov 2010, 4:09 PM
There is no way to do this???? I just dont want to use timeout as already my function takes alot of time (offcourse only in some cases).....

Please help me..
Regards

Screamy
17 Nov 2010, 10:58 AM
This always works for me:


Ext.Msg.progress('Please wait', 'Updating Something', '...working...');

// after 10% of the work is done.
Ext.Msg.updateProgress(.1, '...working...', 'Updating Something: 10%' );

// after 20% done.
Ext.Msg.updateProgress(.2, '...working...', 'Updating Something: 20%' );

// etc.
Ext.Msg.updateProgress(.3, '...working...', 'Updating Something: 30%' );


You could also try the 'indeterminate' style progress bar:


Ext.Msg.wait('Updating Something', 'Please wait')then hide() when done.

matt617
17 Nov 2010, 12:11 PM
what does firebug say when you try updateProgress? always worked for me...

shahdollie
17 Nov 2010, 2:18 PM
Hi thanks for replying....

When i use console.log() before updateProgress method.......everything works fine. Means progress bar updates as it should....but if i comment console.log() then it doesn't show the updated message in progress bar...(only in firefox)

What could be the problem???

Regards

Condor
17 Nov 2010, 2:58 PM
So this is an IE issue? Do you have a long running process where you are updating the progress in between?

That long process thread is locking up the browser. Progress changes are only visible after the thread ends.

The only solution I know is to interrupt processing with a small setTimeout.

shahdollie
17 Nov 2010, 4:20 PM
Hi Condor thanks for replying...

Its not an IE issue. But i guess you are correct as my process could be locking up the browser.

Could u give an example on how to implement timeout in such a way. I already tried using setTimeout at various places but that also didn't help.... If you could explain a bit that would be really helpful.

My code is something like this...


mask.show();

for(var i=0; i<50; i++){

//console.log("i = " + i);
mask.updateProgress(i / 50, (i+1) + " of 50", "Processing...");
function_a(i); // This function might be locking the browser
}

mask.hide();


Regards

matt617
18 Nov 2010, 6:36 AM
i do not think a for loop is really what you want to do. i am not a code execution expert but i am pretty sure for loops execute synchronously, so basically you wont see 1-49 youll only see 50 and it will move on right?

whenever i have done progress updates it has been based on a task runner on a CometD push of an update, never a synchronous loop

Condor
18 Nov 2010, 11:33 AM
Something like:

mask.show();
var i = 0;
function call_function_a() {
mask.updateProgress(i / 50, (i+1) + " of 50", "Processing...")
function_a(i);
i++;
if (i < 50) {
setTimeout(1, call_function_a);
} else {
mask.hide();
}
}
call_function_a();

shahdollie
22 Nov 2010, 4:20 PM
hi thanks Condor.... I tried to implement that but i still it doesn't work...

I know now what is is the problem.....actually i am calling a Flash method which freezes my browser...and which is asynchronous...
So trying to figure out how to send synchronouse request in flash then only this will work...

Thanks alot for help

Regards