Unfortunately that won't work well in our design. We declare the UI in
meta data and the data binding takes places automatically. I've decided
it would be easier to patch the selectbox instead, this works great and
means we don't have to add special handling to our widget creation :)
qx.Mixin.define("custom.patch.MSelectBox",
{
construct : function()
{
this.addListener("changeSelection", function(e)
{
var sel = e.getData();
this.fireDataEvent("changeModelSelection",
[(sel && sel.length) ? sel[0].getModel()
: null]);
}, this);
},
events :
{
"changeModelSelection" : "qx.event.type.Data"
}
});
I'm happy with this,
kudos on the good work,
Matt
MartinWittemann wrote:
> Hi Matt,
> I did get it right but i think my answer was not that clear. You can still
> use the changeSelection event and write a converter which gets the model
> value and returns that:
>
> selectBox.bind("selection", ourModel, "selection", {
> converter : function(data) {
> return data[0].getModel();
> }});
>
> Regards,
> Martin
>
>
>
> Noggin182 wrote:
>> Sorry I think you missed what I meant.
>> We don't listen to the event ourselves, we use databinding to bind from
>> the model to the ui and then back again.
>>
>> Our code is quite complicated but it basically does something like this:
>>
>> qx.data.SingleValueBinding.bind(ourModel,
>> "selection",
>>
>> selectBox,
>> "modelSelection");
>>
>> qx.data.SingleValueBinding.bind(selectBox,
>> "modelSelection",
>>
>> ourModel,
>> "selection");
>>
>> The first binding works fine but the second doesn't as it looks for the
>> changeModelSelection event
>>
>> Hope that clears things up,
>> Matt
>>
>> MartinWittemann wrote:
>>> Hi,
>>> just use the changeSelection event because it is fired exactly on the
>>> same
>>> times. Thats why we decided not to supply such an event.
>>> Best,
>>> Martin
>>>
>>>
>>> Noggin182 wrote:
>>>> This is good! I was working on something similar in our code base. One
>>>> problem though, there is no changeModelSelection event so we can't use
>>>> the databinding in the reverse way, would this be easy to add?
>>>>
>>>> Thanks,
>>>> Matt
>>>>
>>>> MartinWittemann wrote:
>>>>> Hello Christian,
>>>>> take a look at revision 20020. :)
>>>>> Cheers,
>>>>> Martin
>>>>>
>>>>>
>>>>>
>>>>> panyasan wrote:
>>>>>> To make more clear what I mean: I have a data store that loads the
>>>>>> values
>>>>>> for
>>>>>> a data record and is then bound to this form:
>>>>>>
>>>>>> http://www.nabble.com/file/p25341125/Bild%2B2.png Bild+2.png
>>>>>>
>>>>>> works great. Now I want to exchange the first TextField ("Reference
>>>>>> Type")
>>>>>> with a SelectBox. The ListItem labels will be show extended and
>>>>>> translated
>>>>>> information on all the reference types that can be chosen.
>>>>>>
>>>>>>
>>>>>> panyasan wrote:
>>>>>>> Hello Martin,
>>>>>>>
>>>>>>> thank you for your quick reply. I would love to see this
>>>>>>> functionality
>>>>>>> as
>>>>>>> soon as possible, so I vote for it -anyone else? This would make
>>>>>>> using
>>>>>>> SelectBox-like widgets (also RadioGroup) so much easier to use with
>>>>>>> forms.
>>>>>>> You bind the form to a model, and, just like TextField widgets, they
>>>>>>> show
>>>>>>> the value that is in the model, and update the model when the
>>>>>>> selection
>>>>>>> changes. Because I generate forms on-the-fly in my application, this
>>>>>>> would
>>>>>>> enormously ease my work - as opposed to having to bind the selection
>>>>>>> widgets manually.
>>>>>>>
>>>>>>> But even the second option is not fully clear to me. It would entail
>>>>>>> a
>>>>>>> lot
>>>>>>> of custom code, wouldn't it - storing the "value" in the "userData"
>>>>>>> (since
>>>>>>> the 'value' property is still deprecated in the current trunk), and
>>>>>>> then
>>>>>>> iterating over the ListItems to select the matching one? Or am I
>>>>>>> still
>>>>>>> not
>>>>>>> getting the point. A short example would be wonderful.
>>>>>>>
>>>>>>> Thank you - as usual - for your great work on databinding - I have
>>>>>>> completely rewritten my app in order to use it ;-)
>>>>>>>
>>>>>>> Christian
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Martin Wittemann wrote:
>>>>>>>> Hello Christian,
>>>>>>>> thats a good point. The form controller still uses the selection for
>>>>>>>> widgets
>>>>>>>> like the SelectBox. But it could use the new model property now if
>>>>>>>> available. Maybe I can get the code changed today and it will land
>>>>>>>> in
>>>>>>>> the
>>>>>>>> 0.8.3 release. (http://bugzilla.qooxdoo.org/show_bug.cgi?id=2754)
>>>>>>>> But anyway, you can always set up the binding yourself without the
>>>>>>>> form
>>>>>>>> controller and bind the model. Take a look at this tread some time
>>>>>>>> ago
>>>>>>>> where
>>>>>>>> I bound a RadioGroup. As SelectBox and RadioGroup do use the same
>>>>>>>> interface
>>>>>>>> you can just use that code if you need it.
>>>>>>>> Best,
>>>>>>>> Martin
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> panyasan wrote:
>>>>>>>>> Hello (Martin),
>>>>>>>>>
>>>>>>>>> I have seen a couple of commits concerning the new selection
>>>>>>>>> support
>>>>>>>>> for
>>>>>>>>> the
>>>>>>>>> form and am eager to put it to use. But I couldn't yet figure out
>>>>>>>>> how
>>>>>>>>> to
>>>>>>>>> do
>>>>>>>>> it.
>>>>>>>>>
>>>>>>>>> Let's say, in a multi-language application, you have a SelectBox
>>>>>>>>> that
>>>>>>>>> displays a couple of choices in the selected language of the
>>>>>>>>> application.
>>>>>>>>> The SelectBox is part of a form, managed by a form controller,
>>>>>>>>> which
>>>>>>>>> bind
>>>>>>>>> the form to a model. The model contains a value for the selected
>>>>>>>>> item
>>>>>>>>> in
>>>>>>>>> the
>>>>>>>>> select box which is language-neutral. How do I have to set up the
>>>>>>>>> SelectBox
>>>>>>>>> that the model, when changed, will automatically preselect the
>>>>>>>>> corresponding
>>>>>>>>> item in the SelectBox? As said before, binding to the label is not
>>>>>>>>> an
>>>>>>>>> option
>>>>>>>>> because the "value" has to be language-neutral - the label is
>>>>>>>>> "decoration",
>>>>>>>>> not "data".
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Christian
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://www.nabble.com/New-Form-Selection-Behavior-tp25336649p25336649.html
>>>>>>>>> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>>> Let Crystal Reports handle the reporting - Free Crystal Reports
>>>>>>>>> 2008
>>>>>>>>> 30-Day
>>>>>>>>> trial. Simplify your report design, integration and deployment -
>>>>>>>>> and
>>>>>>>>> focus
>>>>>>>>> on
>>>>>>>>> what you do best, core application coding. Discover what's new with
>>>>>>>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>>>>>>>> _______________________________________________
>>>>>>>>> qooxdoo-devel mailing list
>>>>>>>>> [email protected]
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>>>>>>>
>>>>>>>>>
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://n2.nabble.com/New-Form-Selection-Behavior-tp3599532p3601266.html
>>>>>>>> Sent from the qooxdoo mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>>>>>>> 30-Day
>>>>>>>> trial. Simplify your report design, integration and deployment - and
>>>>>>>> focus on
>>>>>>>> what you do best, core application coding. Discover what's new with
>>>>>>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>>>>>>> _______________________________________________
>>>>>>>> qooxdoo-devel mailing list
>>>>>>>> [email protected]
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>>>>>>
>>>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/New-Form-Selection-Behavior-tp25336649p25341125.html
>>>>>> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>>>>> 30-Day
>>>>>> trial. Simplify your report design, integration and deployment - and
>>>>>> focus
>>>>>> on
>>>>>> what you do best, core application coding. Discover what's new with
>>>>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>>>>> _______________________________________________
>>>>>> qooxdoo-devel mailing list
>>>>>> [email protected]
>>>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>>>>
>>>>>>
>>>> ------------------------------------------------------------------------------
>>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>>> 30-Day
>>>> trial. Simplify your report design, integration and deployment - and
>>>> focus
>>>> on
>>>> what you do best, core application coding. Discover what's new with
>>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>>> _______________________________________________
>>>> qooxdoo-devel mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>>
>>>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel