The code you have posted is the server side code. To refresh the UI, you will need to write the update UI operations explicitly.
You can have these methods return the POJO which was affected and use that to refresh your UI.
In pseudo code:
1) Initiate the server call from the UI, typically on a button click or some similar user action
2) The server call method is defined by you, so you can have whatever return types you want. In your case it can return the required POJO
3) Once you get the POJO back, you can modify your UI accordingly.
The steps and code required to do this cannot be posted here. Instead, check out the GWT site which has code samples and a detailed explanation.
The code looks OK.
You get a list of POJOs and you update the flex table with the ID, name and a delete button.
You can store a copy of the account list as an instance variable. Populate it when your UI is built the first time.
When you add a new account, add the newly created POJO to this list and rebuild the UI.
When you delete an account, remove the POJO from this list and rebuild the UI.
For this you will need to remove all existing data using the appropriate remove methods, or better yet just create a new instance of the FlexTable and (re)populate it
As per your code, after a successful async call, you are adding rows containing the data for id, number and the button. For every UI refresh, you can invoke FlextTable#removeAllRows and then use your existing code to populate it.
You should use 'Store' and 'Loader' to bind your data with grid, that way after successfully update you would just call load method on your loader and changes will be reflected immediately and with no extra coding.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop