Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

CRUD + Hibernate + GWT

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am making a crud example with hibernate and gwt.
I made the following to delete and read:



They work perfectly, the information change on my mysql database, but the problem is that when I execute them the page/tables does not refresh automatically.

Does anyone knows how to make the dynamic update when the table is changed ?

Thank you!
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
matias casal
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

you will need to write the update UI operations explicitly


I did not make that.

Can you explain me shortly how to write the update UI operations ? Or give any tutorial about this ?
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
 
matias casal
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could not understand correctly.
My delete UI is something like this



What should I add to this to make it works ?
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
matias casal
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.



I have my different flextables in different classes that exteds composites.

Thats what I would like to know, how should I rebuild the UI ???

Thanks!
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic