tags:

views:

36

answers:

1

I am facing problems in setting model values containing numeric properties. Here is the example:

This code does not work:

var modelSkeleton = {id: null, name: null};
var model = rx.data.marshal.Json.createModel(modelSkeleton);
var x = {id:22,name:"New name"};
model.set(x);

However if I put quotes on id value, it works:

var modelSkeleton = {id: null, name: null};
var model = rx.data.marshal.Json.createModel(modelSkeleton);
var y = {id:"22",name:"New name"}
model.set(y);

Am I doing some mistake or this is a bug? Any quick solution?

+1  A: 

Hey,

I think there is something missing of the concepts of the qooxdoo data binding. For that, you need to know what your second line in your code is doing. This one brings you a bit of magic which creates a qooxdoo class based on your JavaScript object and instanciates an object of it which is returned. All the properties attached to your native JavaScript object will be available as qooxdoo properties which have to be accessed with the commonly used getter and setter. The set method you use is just a shortcut which parses your given object and sets each property contained. So usually that should work but its important to know what you are doing here because there are restrictions when you have more complex objects like arrays, this way is not working.

Regards,
Martin
Btw. its always qx and not rx. :)

Martin Wittemann