Question

Here is my problem, I hope some one can help me here, I'm developing a mobile app in qx.

In the application.js I call for a JSON in a server through the qx.store.json(url) that creates a model that I bind to a offline model to access the data offline in the app.

Everything good so far then when I try to access the data in the offline model it doesn't let me. The original JSON data is

array(timestamp=>time(),
      userdata=>array(
          array(userid=>0...),
          array(userid=>1...)))

When I debug the JSON or the offline data with obj.getItem(1) it always returns me qx.data.model.userdata.

I'm trying to use the data inside the array of userdata to validate a user in a foreach statement but qx.data.model.userdata always returns undefined.

I try obj.getUserdata(), obj.getItem(1), obj being the offline model.

What am I doing wrong? It isn't a model a store for data, or it can only be used as binding data to an widget?

Was it helpful?

Solution

If the item at index 1 was an Array, obj.getItem(1) would return an instance of qx.data.Array. Since it returns an instance of qx.data.model.userdata, that means the model item is actually an object with a single property named "userdata" and you would access the value by calling obj.getItem(1).getUserdata().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top