This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Populate Dropdowns

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am trying to populate a dropdown from database using rpc (Async). The problem is the page gets download and dropdown does not get populated, but it has the values.

I believe the approach that i took is incorrect, it should not be Async, but again i did not find any other way to call the service from gwt client

Can someone helpme on this

Thanks
 
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The problem is the page gets download and dropdown does not get populated, but it has the values.


This is a little bit of contradictory as well as confusing.
Could you please explain what you mean by
1) page gets downloaded (Downloaded as on to the disk?)
2) dropdown does not get populated, but it has the values
 
rudreshashok kumar
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) page gets downloaded (Downloaded as on to the disk?)
I meant the Page is rendered with empty dropdown values
I had put a debug point on the service layer, that gets called after the page is rendered.

2) dropdown does not get populated, but it has the values
I meant that dropdown does not get populated

I a gist i have a simple html and in the onmoduleLoad method i am trying to populate a dropdown, for now let us say it is Male/Female. This value is a reference data and that comes from database.
I have written a service(ServiceImpl) would query database and result the arrayList, this is been called from gwt client through rpc

ServiceAsync serviceAsync = GWT.create(Service.class)

String[] str = null;
serviceAsync.getMasterData(new AsyncCallback<String[]>()) {

OnFailure{}
OnSuccess (String[] result){
str =result
}

//now populate dropdown.

Some how i felt this will work for onclick events but not onload as this is asynchronous call and will not wait and proceed with executing onmoduleload method

Hope this clarifies

Thanks

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Where do you populate the list box? You need to double check you are populating the one which you have added to your code and not creating a new one.

Some how i felt this will work for onclick events but not onload as this is asynchronous call and will not wait and proceed with executing onmoduleload method


Did you try it out? What happened?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!