Hi Jim, I managed doing it by initializing the JSON dependent object in the callback function. Thanks a lot for the hint... :)
Cheers, Amit Dhingra On Sun, Sep 21, 2008 at 9:23 PM, Amit Dhingra <[EMAIL PROTECTED]>wrote: > Hi Jim, > Thanks a lot for the hint into it!!! > These calls are asynchronous... silly newbie error... > > As you said about the RequestBuilder methods, and that I need to chain > events, I was thinking of the following solution. Please lemme know if this > seems okay. :) > > I keep a flag, which I set once my async callback occurs, and I have > processed JSON. On the other hand I poll on the flag before I use the data. > > Is there an industry standard method on this. > > Thanks in advance!!! > > Regards, > Amit > > > On Sun, Sep 21, 2008 at 8:39 PM, Jim Freeze <[EMAIL PROTECTED]> wrote: > >> >> On Sun, Sep 21, 2008 at 7:38 AM, Amit Dhingra <[EMAIL PROTECTED]> >> wrote: >> > Hi, >> > I am trying to access PHP from my GWT code, where I access the database >> and >> > form JSON of the data, which is send back to the GWT. >> >> It sounds like you are saying that you want to get an asynchronous >> response back from some server that happens to be running PHP and >> happens to be accessing some database. >> >> > For the following code GWT code >> > private SampleEventCacheController eventCache = new >> > SampleEventCacheController(); // I access PHP from this constructor >> > >> > private MultiView multiPanel = new MultiView(eventCache, new >> > DefaultStringPanelRenderer()); >> > >> > Now in the MultiView constructor, I tend to access the HashMap which >> must >> > have been filled by the JSON data. I expect that the JSON data will be >> > filled before the MultiView constructor gets called, but this is not >> what is >> > happening. The call to the function which populates the HashMap cames >> way >> > later when the MultiView constructor is done. >> >> Seems to me you are thinking calls to the server happen synchronously, >> and I'm guessing your call to the server is happening asynchronously. >> And, I'm not sure eventCache can ever contain the response value from >> an asynchronous call. >> >> Look at RequestBuilder. There are two callback methods that are called >> when a response is returned from the server. You will need to chain >> your actions, that rely on the returned data, from the callback. >> >> Does that make sense? >> >> >> >> >> -- >> Jim Freeze >> >> >> >> > > > -- > Warm Regards, > Amit Dhingra > -- Warm Regards, Amit Dhingra --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
