thank you  very much. i solved the problem already thank you!

On Feb 6, 5:24 pm, Jason Essington <[email protected]> wrote:
> gregor is right, you are trying to perform your update synchronously  
> but your request is happening asynchronously.
>
> A full explanation of your exact problem can be found in this 
> post:http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...
>
> -jason
>
> On Feb 6, 2009, at 6:10 AM, gregor wrote:
>
>
>
> > Your problem looks like it's here:
>
> > private void updateGrid1(GridPanel gridPanel, int cols, int rows) {
> >     if (store != null) {
> >         store.removeAll();
> >     }
> >     getData1(1);  <<<<<<<<<<<< PROBLEM
>
> >     Object[][] data = null;
>
> >     if(displayData1!= null) {     <<<<<<<<<PRBLEM: displayData not
> > yet updated!!!!!!!!
> >         data = getCompanyData(displayData1, 1);
> >     }
> >     else {
> >         System.out.println("exception at update1();");
> >         return;
> >     }
>
> > caused by:
>
> >           // success
> >           public void onSuccess(Object result) {
> >            // Cast the result into the object that was sent
> >            // This casts the random object into DataContainer
> >            // Since the object is an array we use []
> >            displayData1 = (DataContainer[]) result;  <<<<<<<< CAUSE:
> > you set variable, you do not call grid update method
>
> >           }
> >          };
>
> > what you need to do is rearrange your logic to call updateGrid1(..)
> > from the async callback onSuccess(..) method. What is happening at the
> > moment is that the grid update code is running at the same time the
> > RPC call is executing over the wire, so ther is no new data in
> > displayData1.
>
> > regards
> > gregor
>
> > On Feb 6, 12:33 pm, ytbryan <[email protected]> wrote:
> >> can someone help?
>
> >> below are my rpc request code.
>
> >> private void getData() {
>
> >>   AsyncCallback<Object> callback = new AsyncCallback<Object>() {
> >>    // fail
> >>    public void onFailure(Throwable ex) {
> >>     RootPanel.get().add(new HTML(ex.toString()));
> >>    }
> >>    // success
> >>    public void onSuccess(Object result) {
> >>     // Cast the result into the object that was sent
> >>     // This casts the random object into DataContainer
> >>     // Since the object is an array we use []
> >>     DataContainer[] displayData = (DataContainer[]) result;
> >>    }
> >>   };
>
> >>   callProvider.getData(callback);
> >>  }
> >>  private void getData1() {
> >>            final int value1 = value;
>
> >>           AsyncCallback<Object> callback1 = new  
> >> AsyncCallback<Object>()
> >> {
> >>            // fail
>
> >>            public void onFailure(Throwable ex) {
> >>             RootPanel.get().add(new HTML(ex.toString()));
>
> >>            }
> >>            // success
> >>            public void onSuccess(Object result) {
> >>             // Cast the result into the object that was sent
> >>             // This casts the random object into DataContainer
> >>             // Since the object is an array we use []
> >>             displayData1 = (DataContainer[]) result;
>
> >>            }
> >>           };
>
> >>           // remote procedure call to the server to get the data
> >>           callProvider1.getData1(callback1);
>
> >>          }
>
> >> below is updategrid1 code which calls the getData1() code
>
> >> private void updateGrid1(GridPanel gridPanel, int cols, int rows) {
> >>      if (store != null) {
> >>          store.removeAll();
> >>      }
> >>      getData1(1);
>
> >>      Object[][] data = null;
>
> >>      if(displayData1!= null) {
> >>          data = getCompanyData(displayData1, 1);
> >>      }
> >>      else {
> >>          System.out.println("exception at update1();");
> >>          return;
> >>      }
>
> >>      RecordDef recordDef = new RecordDef(
> >>              new FieldDef[]{
>
> >>                    new StringFieldDef("date"),
> >>                    new IntegerFieldDef("opensource"),
> >>                    new IntegerFieldDef("trial"),
> >>                    new IntegerFieldDef("sales"),
> >>                    new StringFieldDef("ostrial"),
> >>                    new StringFieldDef("trialsale") ,
> >>                    new StringFieldDef("ossale")
> >>              }
> >>      );
> >>      ColumnConfig[] columns = new ColumnConfig[]{
> >>              //column ID is company which is later used in
> >> setAutoExpandColumn
> >>              new ColumnConfig("Date", "date", 160, true, null,
> >> "company"),
> >>              new ColumnConfig("Open Source", "opensource", 35,true),
> >>              new ColumnConfig("Trial", "trial", 45,true),
> >>              new ColumnConfig("Sales", "sales", 65,true),
> >>              new ColumnConfig("OS-Trial", "ostrial", 65),
> >>              new ColumnConfig("Trial-Sale", "trialsale", 60, true),
> >>              new ColumnConfig("OS-Sale", "ossale", 60, true)
> >>      };
>
> >>      ColumnModel columnModel = new ColumnModel(columns);
>
> >>      MemoryProxy proxy = new MemoryProxy(data);
> >>      ArrayReader reader = new ArrayReader(recordDef);
> >>      store = new Store(proxy, reader);
> >>      store.load();
>
> >>      gridPanel.reconfigure(store, columnModel);
>
> >>  }
>
> >> below is my button code which get trigger when pressed. and it has
> >> listener that will call updategrid1()!!! please ignore those
> >> unnecessary parameter that are unused.
>
> >>  ToolbarButton generateButton1 = new ToolbarButton("test", new
> >> ButtonListenerAdapter() {
> >>                       public void onClick(Button button,  
> >> EventObject e) {
> >>                           updateGrid1(gridPanel,  
> >> cols.getValue().intValue(),
> >> rows.getValue().intValue());
> >>                       }
> >>                   });
> >>                   generateButton1.setIconCls("database-add-icon");
> >>                   bottom.addButton(generateButton1);
>
> >> }
>
> >> can someone help!
>
> >> On Feb 6, 12:14 pm, ytbryan <[email protected]> wrote:
>
> >>> I just insert Window.alert("") into getdata1(); and i realised that
> >>> the method is called but no window alert appears. i inserted  a
> >>> println after onsuccess and onfailure and something is printed out.
>
> >>> basically, onsuccess and onfailure are skipped? how is it possible?
>
> >>> On Feb 6, 11:58 am, ytbryan <[email protected]> wrote:
>
> >>>> below is the code where i execute the rpc request. i create  
> >>>> getdata()
> >>>> and getdata1() to get execute different query. i am using two Async
> >>>> object to make call. i am  not sure is it correct as i got error  
> >>>> when
> >>>> i use one. any help/advice is welcome and appreciated. :D
>
> >>>> private void getData() {
>
> >>>>   AsyncCallback<Object> callback = new AsyncCallback<Object>() {
> >>>>    // fail
> >>>>    public void onFailure(Throwable ex) {
> >>>>     RootPanel.get().add(new HTML(ex.toString()));
> >>>>    }
> >>>>    // success
> >>>>    public void onSuccess(Object result) {
> >>>>     // Cast the result into the object that was sent
> >>>>     // This casts the random object into DataContainer
> >>>>     // Since the object is an array we use []
> >>>>     DataContainer[] displayData = (DataContainer[]) result;
> >>>>    }
> >>>>   };
>
> >>>>   callProvider.getData(callback);
> >>>>  }
> >>>>  private void getData1() {
> >>>>            final int value1 = value;
>
> >>>>           AsyncCallback<Object> callback1 = new  
> >>>> AsyncCallback<Object>(){
> >>>>            // fail
>
> >>>>            public void onFailure(Throwable ex) {
> >>>>             RootPanel.get().add(new HTML(ex.toString()));
>
> >>>>            }
> >>>>            // success
> >>>>            public void onSuccess(Object result) {
> >>>>             // Cast the result into the object that was sent
> >>>>             // This casts the random object into DataContainer
> >>>>             // Since the object is an array we use []
> >>>>             displayData1 = (DataContainer[]) result;
>
> >>>>            }
> >>>>           };
>
> >>>>           // remote procedure call to the server to get the data
> >>>>           callProvider1.getData1(callback1);
>
> >>>>          }
>
> >>>> On Feb 6, 11:46 am, mon3y <[email protected]> wrote:
>
> >>>>> Hi
>
> >>>>> A code snippet would be nice, so we can see where you're going  
> >>>>> wrong.
>
> >>>>> Also put a Window.alert(""), in your onFailure and onSuccess of  
> >>>>> your
> >>>>> second call to see what you get.
>
> >>>>> If it comes into the onFailure of your second call, there must be
> >>>>> something wrong with the way you're calling the server side or  
> >>>>> your
> >>>>> interfaces.
>
> >>>>> If it comes in on your onSuccess, it must be a logic error, or
> >>>>> something else pertaining to your client side code.
>
> >>>>> If you make the first call successful and you call the second  
> >>>>> one the
> >>>>> same way(logically) then there should be no issues.
>
> >>>>> :)
>
> >>>>> On Feb 6, 12:39 pm, ytbryan <[email protected]> wrote:
>
> >>>>>> Hi all,
> >>>>>> i know gwt don support synchronous call and i read it somwhere  
> >>>>>> that
> >>>>>> there is actually don need to make rpc call synchronous.
>
> >>>>>> but i created an application with buttons like " save data"  
> >>>>>> and "
> >>>>>> display result "that will communicate to server by fetching  
> >>>>>> data or
> >>>>>> saving data.
>
> >>>>>> when the application starts, it will automatically display the  
> >>>>>> first
> >>>>>> result with its first rpc call. but when i click the display  
> >>>>>> second
> >>>>>> result's button....... it doesn't work anymore. any subsequent  
> >>>>>> rpc
> >>>>>> call after the first one don't work.
>
> >>>>>> what is wrong here? and what am i missing? can someone advice  
> >>>>>> me? the
> >>>>>> usual rpc example online only show how to make one rpc call. is  
> >>>>>> there
> >>>>>> a way to make multiple calls that do different task? thank you  
> >>>>>> for
> >>>>>> your time in viewing this post.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to