• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,

Cheers.
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic