• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
  • Himai Minh
  • Carey Brown
  • salvin francis

Passing a String[] to EntryPoint class sends a null object!

Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using GWT 2.0.3 and smartGWT 2.2. I don't think this is a smartGWT specific problem its a GWT question. I am working on a building a GWT front end to a simple database. I have successfully made a datagrid and imported data from an MySQL database to a DataGrid item. I am using an extra class to do the AsyncCallBack and get the data. It works perfectly for one class. I need to populate a combo box and I created another class. Heres the code..

In the class which has the onModuleLoad() method (entry point class) I am initializing the above class and using the getDesigns() method to get the data but the getDesigns ALWAYS returns a null object. I am utterly confused as to why.. I am doing the same thing on another class from which im getting all the other data from my database to populate the DataGrid and it works. There I am creating a DataSource and adding records to it and then using a getDataSource() method exactly like the above class, im importing the data to the entrypoint class. I can't understand why i cant pass a string array. Any help would be great!! Thanks!!
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nipuna,

I assume that you already solved this, but I figure I can always respond anyway.

You did not provide the code where you use the DesignsAndCriteria class, but I am assuming that you it looks like this:

The problem with that is that initializeDesignsArray calls a synchronous function. Therefore, there are no guaranties that the designs variable is set when you call the getDesigns function.

There are many ways to solve this problem, one that comes to mind by looking at your code is the following:

and then change your code calling DesignsAndCriteria:

This will basically delay your initilization code until you have recieved the data from the synchronous call.

Hopes this helps,

It sure was nice of your sister to lend us her car. Let's show our appreciation by sharing this tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic