Hi Eduardo,

Eduardo Robles Elvira wrote:
> 
> Just some random thoughts in the night: it could be awesome and
> powerful if a list controller could have a modelPath. So you could do
> something like:
> 
> ....
> var = data [
>           {name: "male", id: 1},
>           {name: "female", id: 2},
>           {name: "dont know!", id: 3},
>           {name: "Alien", id: 4}
> ];
> 
> var model = qx.data.marshal.Json.createModel(data);
> 
> var gender = new qx.ui.form.SelectBox();
> var controller = new qx.data.controller.List(model.getGender(), gender,
> "name");
> controller.setModelPath("id");
> form.add(gender, "Gender");
> ....
> 
> 
Hm, thats something I need to think about. Sounds like a hack for a problem
we shouldn't have. On one hand, we want to have the data in the model, on
the other hand we won't. So just using the "modelPath" would override the
original data which could lead to problems. 
I also thing it's the wrong place to do the "conversion". The UI shows the
data in the model so why should the model contain different data. Imagine
you change the backend implementation and the Server now needs the name
instead of the id. With that you have to take a look at the UI code and fix
that server change. Hm, sounds not right to me... What do you thing?


Eduardo Robles Elvira wrote:
> 
> Also sometimes one only needs a quick and dirt select box, without
> wanting to think about controllers, etc. To this extents I have a
> simple SelectBox that works like this (which internally of courses
> uses a marshaler and a list controler):
> 
> form.add(new qx.ui.form.SimpleSelectBox(["male", "female"]), "Gender");
> 
Well, you don't need to use the controller and binding stuff. Just use a
default SelectBox filled with ListItems works fine too. 

Regards,
Martin
-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/SelectBox-set-selection-tp4798272p4978889.html
Sent from the qooxdoo mailing list archive at Nabble.com.

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

Reply via email to