• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Populate Dropdowns

 
rudreshashok kumar
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
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 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
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic