How can I add objects to ComboBox?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I add objects to ComboBox?

voger
I am reading the documentation and I see examples but I can't understand
how ComboBox and SelectBox work. How adding items and data binding
between the model and the widget works? What is the purpose of
controller? I am not asking for technical details. Just practical workflow.

I have this example http://tinyurl.com/o4qt722 and this
http://tinyurl.com/qypqe3v I can't make them work
I am trying to adjust from this example http://tinyurl.com/nceka5a

What I have done is that I have sub classed the ComboBox so on
appearance (couldn't make the event work in DemoBrowser) it connects via
RPC and get's a list of countries. Then it creates a model to populate
the ComboBox.

What I want to do is in the list to be displayed the name but in the
model to be set selected the code2. Very common requirement, plenty
examples on the list but unfortunately I can't make it work.

Also I would like to have a reference to the controller so I won't have
to initialize a controller etc. every time I need this class. I wan't it
to be as autonomous as possible.


I have no idea what

newVal.setDelegate({
       bindItem: function(newVal, item, id) {
       newVal.bindProperty("name", "label", null, item, id);
       newVal.bindProperty("code2", "model", null, item, id);
       }

is doing. I have read the docs but still can't understand how it works.

Also I get this error in the logs

"1654876 playground.Application[18-0]: GlobalError:
this.getTarget(...).add is not a function"

Can someone please help me make it work. And if it is possible to
explain with simple words how databinding between the model properties
is supposed to work?

Is there any simpler way to achieve what I want?

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I add objects to ComboBox?

voger

On 20/06/2015 08:42 μμ, voger wrote:

> I am reading the documentation and I see examples but I can't understand
> how ComboBox and SelectBox work. How adding items and data binding
> between the model and the widget works? What is the purpose of
> controller? I am not asking for technical details. Just practical workflow.
>
> I have this example http://tinyurl.com/o4qt722 and this
> http://tinyurl.com/qypqe3v I can't make them work
> I am trying to adjust from this example http://tinyurl.com/nceka5a
>
> What I have done is that I have sub classed the ComboBox so on
> appearance (couldn't make the event work in DemoBrowser) it connects via
> RPC and get's a list of countries. Then it creates a model to populate
> the ComboBox.
>
> What I want to do is in the list to be displayed the name but in the
> model to be set selected the code2. Very common requirement, plenty
> examples on the list but unfortunately I can't make it work.
>
> Also I would like to have a reference to the controller so I won't have
> to initialize a controller etc. every time I need this class. I wan't it
> to be as autonomous as possible.
>
>
> I have no idea what
>
> newVal.setDelegate({
>         bindItem: function(newVal, item, id) {
>         newVal.bindProperty("name", "label", null, item, id);
>         newVal.bindProperty("code2", "model", null, item, id);
>         }
>
> is doing. I have read the docs but still can't understand how it works.
>
> Also I get this error in the logs
>
> "1654876 playground.Application[18-0]: GlobalError:
> this.getTarget(...).add is not a function"
>
> Can someone please help me make it work. And if it is possible to
> explain with simple words how databinding between the model properties
> is supposed to work?
>
> Is there any simpler way to achieve what I want?
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>

The more I keep trying the more I realize that SelectBox API is
different than VirtualSelectBox API which in turn is different than
VirtualComboBox API. So I guess when I use the Virtual widgets I don't
need a controller?

Can someone please provide a modified example of this
http://tinyurl.com/nceka5a for VirtualComboBox?



------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: How can I add objects to ComboBox?

voger
The closer I managed to get is this http://tinyurl.com/p6xud3h
but I don't think this is the way it is supposed to work. Is there any
better way?

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel