+ Start a Discussion
asadimasadim 

Progress bar?

Hi,

 

Does anybody know how to display a progress bar in VF? The counter would be provided by the controller. actionPoller is very slow (cannot be faster than every 5 sec) so I'm looking for another method. I'm sure something must be possible using actionSupport or actionFunction but I'm not sure how to go about it.

 

Thanks.

Message Edited by asadim on 11-02-2009 03:55 PM
Best Answer chosen by Admin (Salesforce Developers) 
ThomasTTThomasTT

I don't know your situation which you want to apply a progress bar for, but I can't come up with any situation which you can apply it. The key word is "View State". Even though we can make asynchronous calls, it doesn't mean it is working on "A" server and we can access to it from other thread.

 

There might be a situation with Batch Apex. I don't think the ApexJob record can have custom parameter field, but if your batch keep updating certain record and your controller looks at the record, it's possible. But in that case, 5 second interval is pretty much reasonable. I don't think it's a very good idea to query every 0.1 second...

 

If you are really crazy about the interval, define actionFunction and define onComplete to call the same function, so it will loop. Don't forget the exit condition. Before you call the same function, check an flag retruned from the controller, then you can stop the loop. It doesn't gurantee that it's faster than 5 seconds, though.

 

ThomasTT

Message Edited by ThomasTT on 11-03-2009 12:45 PM

All Answers

ThomasTTThomasTT

I don't know your situation which you want to apply a progress bar for, but I can't come up with any situation which you can apply it. The key word is "View State". Even though we can make asynchronous calls, it doesn't mean it is working on "A" server and we can access to it from other thread.

 

There might be a situation with Batch Apex. I don't think the ApexJob record can have custom parameter field, but if your batch keep updating certain record and your controller looks at the record, it's possible. But in that case, 5 second interval is pretty much reasonable. I don't think it's a very good idea to query every 0.1 second...

 

If you are really crazy about the interval, define actionFunction and define onComplete to call the same function, so it will loop. Don't forget the exit condition. Before you call the same function, check an flag retruned from the controller, then you can stop the loop. It doesn't gurantee that it's faster than 5 seconds, though.

 

ThomasTT

Message Edited by ThomasTT on 11-03-2009 12:45 PM
This was selected as the best answer
asadimasadim
Yes batch Apex is what this is to be used for. And that's an intersting idea; let me implement that and see what happens.