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
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to