Reputation: 8035
I am using GWT and i am making RPC calls to get some data from database. I use this data to draw charts with Google Charts API. The problem is that GWT RPC call is async and my chart is always using data from the last call, not the current one.(i populate int array in onSuccess function)). How should i wait some time to make sure that RPC completes and writes my array and then draw my chart, since there is no Thread.sleep() function?
Upvotes: 3
Views: 8778
Reputation: 19793
Another way is to use event bus and custom event to draw charts based on retrieved data. When rpc call returns with success you create this event and fire it. Appropriate controller should subscribe to the event and draw chart upon receiving it. See this on how to implement it.
Upvotes: 1