Hi Fritz

No need because there is no way for the user to set the selection to null
via the standard UI (it wouldn't have any effect anyway because that code
sample does not reflect the changes to selectionMode in the List - it's only
used when the List is created).

John

-----Original Message-----
From: Fritz Zaucker [mailto:[email protected]] 
Sent: 30 July 2009 16:31
To: qooxdoo Development
Subject: Re: [qooxdoo-devel] Selection mode for SelectBox

Hi John,

thanks, looks good to me ...

So I guess to get the "proper" HTML-like behaviour I would set the
selectionMode to "one" after populating the SelectBox from the RPC-call?

Cheers,
Fritz

On Thu, 30 Jul 2009, John Spackman wrote:

> Hi Fritz,
>
> Derive a class from qx.ui.form.SelectBox and add this property:
>
>               selectionMode: {
>                       init: "one",
>                       nullable: false,
>                       check: [ "single", "one" ]
>               }
>
>
> And this member:
>
>           // overridden
>           _createChildControlImpl : function(id)
>           {
>             var control;
>
>             switch(id)
>             {
>               case "list":
>                 control = new qx.ui.form.List().set({
>                   focusable: false,
>                   keepFocus: true,
>                   height: null,
>                   width: null,
>                   maxHeight: this.getMaxListHeight(),
>                   selectionMode: this.getSelectionMode(),
>                   quickSelection: true
>                 });
>
>                 control.addListener("changeSelection",
> this._onListChangeSelection, this);
>                 control.addListener("mousedown", this._onListMouseDown,
> this);
>                 break;
>             }
>
>             return control || this.base(arguments, id);
>           }
>
> This is identical to the base class except where you set the selectionMode
> property to "single"; that allows you to have null selection.
>
> John
>
>
> -----Original Message-----
> From: Fritz Zaucker [mailto:[email protected]]
> Sent: 30 July 2009 14:53
> To: qooxdoo Development
> Subject: Re: [qooxdoo-devel] Selection mode for SelectBox
>
> It happens that I am struggeling with the same problem right now
(populating
> the SelectBox through a rpc-call and having the event handler already
> attached).
>
> I guess one work-around would be to add a flag to the SelectBox with
> setUserData, setting it to 'loading' at the start of the rpc-call setting
it
> to 'done' in the rpc-callback after the loading is done.
>
> And have the event handler check for the flag with getUserData and have it
> ignore the event while 'loading".
>
> Cheers,
> Fritz
>
> On Thu, 30 Jul 2009, John Spackman wrote:
>
>> Sure, but that doesn?t change my point ? the SelectBox fires
>> changeValue/changeSelected events because you haven?t finished populating
>> the list yet.
>>
>> EG if you have 6 items (?Item1? to ?Item6?) and you want ?Item3? to be
the
>> selected one ? you will get two changeValue/changeSelected events, one
>> during population of the list for ?Item1? and one as you bind data to it
>> for ?Item3?.  And it?s not consistent because if you _do_ happen to want
>> to set ?Item1? as selected, you will only get one
>> changeValue/changeSelected event for ?Item1? during population of the
>> list....and before you have bound all the rest of your data to the form.
>>
>> You could preserve the behaviour as you described it by always explicitly
>> setting the selection in code ? and if Qx adds a selectionMode property
to
>> SelectBox that allows ?single? or ?one? (and which defaults to ?one?)
then
>> it is backwards compatible and the event handling can be predictable.
>>
>> John
>>
>> From: Gene Amtower [mailto:[email protected]]
>> Sent: 30 July 2009 13:58
>> To: qooxdoo Development
>> Subject: Re: [qooxdoo-devel] Selection mode for SelectBox
>>
>>
>>
>> This item has been discussed on the list previously, and as I think about
>> it now, this is normal HTML behavior.  In my web development of forms in
>> plain HTML, I always had to insert a non-value entry first that
instructed
>> the user to select an entry to get around this HTML behavior.  I think
the
>> same should be done in your Qooxdoo code to avoid non-standard behaviors
>> with single-height picklists.  Otherwise, you risk confusing the user who
>> is used to seeing the standard behavior of the first entry being the
>> default entry.
>>
>> HTH,
>>
>>   Gene
>>
>>
>> On Thu, 2009-07-30 at 13:12 +0100, John Spackman wrote:
>>
>> Hi,
>>
>> The SelectBox control always wants to have at least one item selected at
>> all times, because the list which it creates has a selectionMode==?one?;
>> the disadvantage of this approach is that changeValue and changeSelected
>> events are fired as you add the first item to the list.  This is kind of
>> OK because you can choose to add the event listeners after you have
>> populated the field (although when you _want_ the first item selected
then
>> your code never sees the events get fired unless you fire them manually),
>> but in a more complex client/server app you?re data binding may happen as
>> a whole separate process to the building of the form and you get unwanted
>> selection events.
>>
>> Just a suggestion, but could the SelectBox be made to not always select a
>> row, eg by changing the selectionMode of the list to ?single? ? or
better,
>> have a selectionMode property of its own?  We?ve derived our own
SelectBox
>> and done that with success.
>>
>> John
>
>

-- 
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

----------------------------------------------------------------------------
--
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

Reply via email to