I am trying to subclass the qx.ui.form.VirtualSelectBox and create a 
widget that on display communicates with the server and gets a list of 
available gender choices.

If I subclass from qx.ui.form.VirtualComboBox  or if I try to run it in 
playground it works as expected. Here is a link http://tinyurl.com/o4r9lsg

 From virtual select box I get this error:

006111 Assertion error! Invalid incoming value for property 'label' of 
class 'qx.ui.basic.Atom': Expected value to be a string but found 
qx.data.model.label"value[1369-0]!

The JSON.stringify(result) looks like this:

[{"label":"","value":"0"},{"label":"Male","value":"m"},{"label":"Female","value":"f"}]

Here is my code:

qx.Class.define("qssite.ui.form.widget.VirtualGenderSelect", {
     extend: qx.ui.form.VirtualSelectBox,

     construct: function(model) {
         this.base(arguments, model);
         this.addListenerOnce("appear", function() {
             this._onAppear();
         });
     },

     members: {
         _onAppear: function() {
             var rpc = new qx.io.remote.Rpc('/remote', 'qssite');
             var self = this;

             // asynchronous call
             var handler = function(result, exc) {
                 if (exc === null) {
                     console.log(JSON.stringify(result));
                     var model = qx.data.marshal.Json.createModel(result);
                     self.setModel(model);
                     self.setLabelPath('label');
                 } else {
                     this.debug("Exception during async call: " + exc);
                 }
             };

             rpc.callAsync(handler, 'qssite.get_gender_choices');
         }
     }
});

What I am doing wrong?

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to