On 5/10/2010 10:19 PM, Christian Hagendorn [via qooxdoo] wrote:
> Hi,
>
> okay, now I understood, why you don't want to use the JSON store. So now
> back to your example.
>
> Your problem with the second step was that your have overlook that the
> request is asynchronous. The marshal should be done in the "complete"
> event.
>
> Here your example, but the marshal is done in the "complete" event:
> <code>
> var label = new qx.ui.basic.Label("Default");
> this.getRoot().add(label);
>
> var req = new qx.io.remote.Request("http://localhost:6781/json/Test",
> "GET", "application/json");
>
> var controller = new qx.data.controller.Object(null);
> controller.addTarget(label, "value", "glossary.title");
>
> req.addListener("completed", function(e){
> var jsonObj = e.getContent();
> var jsonModel = qx.data.marshal.Json.createModel(jsonObj, true);
> controller.setModel(jsonModel);
> });
>
> req.send();
> </code>
>
> Cheers,
> Chris
>
> Am 10.05.2010 15:19, schrieb uglyhunK:
>
> > Hi Chris,
> >
> > Thanks for that. But I'm actually looking NOT to use json store. I'm
> looking
> > to
> > - fetch json data using ajax request from the server then
> > - use json marshal to create model
> > - create a controller and bind model and the UI.
> >
> > I managed to do the first step. But things are not looking good from
> step-2.
> > Here is the slightly modified code
> >
> > var label = new qx.ui.basic.Label("Default");
> > this.getRoot().add(label);
> >
> > var req = new
> qx.io.remote.Request("http://localhost:6781/json/Test", "GET",
> > "application/json");
> > var jsonObj;
> > req.addListener("completed", function(e){
> > var jsonObj = e.getContent();
> > });
> >
> > req.send();
> >
> > // create model
> > var jsonModel = qx.data.marshal.Json.createModel(jsonObj, true);
> >
> > // create controller
> > var controller = new qx.data.controller.Object(jsonModel);
> > controller.setModel(jsonModel);
> > controller.addTarget(label, "value", "jsonModel.glossary.title");
> > http://n2.nabble.com/file/n5030517/json_response.txt json_response.txt
> >
> > But nothing seems to be happening to the label. I have attached the
> json
> > response that I receive.
> >
> > Thanks
> >
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=5031638&i=0>
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------------------------------------------------
> View message @
> http://qooxdoo.678.n2.nabble.com/ajax-request-problem-tp5022288p5031638.html
>
> To unsubscribe from Re: ajax request problem, click here
> < (link removed) ==>.
>
>
Chris,
I'm just trying to understand how all this works. So, don't wanna use
json store. Second, with json we can't make post requests. In that case,
there is no option but to use custom store and json marshal (assuming
response is json). Thanks for the response...will check it out.
Cheers
--
View this message in context:
http://qooxdoo.678.n2.nabble.com/ajax-request-problem-tp5022288p5033960.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel