Thanks. This explains the error message I was seeing. I thought I was
going crazy. The qx.data.store.Rest was getting a string from the server
while the qx.data.store.Json was coincidentally getting a JSON response
in the form [{id: "en", name: "English"}]. Now imagine my confusion.
Finally the problem was that I was constructing the "site/tos/{lang}"
URI on display, before the variable {lang} was available so the
qx.ui.embed.Html tried to use the default model. I changed the listener
from:
this.addListener("appear", function() {
//stuff here
},this);
to:
languagesStore.addListener("loaded", function() {
//stuff here
},this);
and now it works.
On 23/09/2015 10:25 πμ, John Spackman wrote:
> The bind is not working because model is not a string, and whatever property
> you bind to qx.ui.embed.Html.html must be a string.
>
> qx.data.store.Rest “marshals” the JSON result into it’s “model” property
> using qx.data.marshal.Json - what that means is that given a JSON data
> structure like:
>
>
> [ { name: “alpha”, id: 1 }, { name: “bravo”, id: 2 } ]
>
> It will create a class on the fly which looks approximately like:
>
> Qx.Class.define(“qx.data.model.id\”name”, {
> extend: qx.core.Object,
> properties: {
> name: {
> check: “String”,
> event: “changeName”
> },
> id: {
> check: “Number”,
> event: “changeId”
> }
> }
> });
>
> And then create two instances of the new class and stick them in an array.
>
> This is obviously useful for binding to Qx objects, and when using the Rest.*
> apis that’s normally what you want but it means that you’re trying to set
> qx.ui.embed.Html.html’s property to an object (maybe a qx.data.Array of
> “qx.data.model.id\”name” objects in this case).
>
> If you want the raw output, try this:
>
> this.__tos.addListener(“getSuccess”, function(evt) {
>
> var data = e.getData();
> this.__tosWidget.setHtml(data||””);
> }, this);
>
> John
------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel