Show a progressbar on datagrid data update
It might sound like a trivial question but how can I show progress bars, when data开发者_StackOverflow中文版grids and other components that "talk" to web services, update their data providers
Start the progress bar on sending the call to the web service, then cancel it when your datagrid sets the dataProvider. You override the public setter for dataProvider and cancel there.
Sorry giving response 2 years later but why not if it may help someone...
You need to do some adaptation when using progress bar with remoting services (RemoteObject, HTTPService, WebService,...). That is :
Set ProgressBar's mode property to the static constant ProgressBarMode.EVENT
Set ProgressBar's source property to some custom object you have implemented and which extends from EventDispatcher
Use your custom source object to manually dispatch event instance of class ProgressEvent with the type of ProgressEvent.PROGRESS to control the fill of the progress bar
You set ProgressEvent.bytesLoaded and ProgressEvent.bytesTotal to control the fill i.e ProgressEvent.bytesLoaded LESS THAN ProgressEvent.bytesTotal when calling your remote service and ProgressEvent.bytesLoaded EQUAL TO ProgressEvent.bytesTotal when your remote service returns (in ResultEvent.RESULT listener for example)
You can optionally set ProgressBar's indeterminate property to true since remoting are often async action with indeterminate duration and amount of returned data. Then you'll use fake values for bytesLoaded and bytesTotal
精彩评论