Hello,
seems like it has something to do with your widget. I just tried the list and
it works as expected, the selection will be removed on the set of a new model:
http://tinyurl.com/2whzmq9
So maybe it has to do with the model selection which is wrong to the time the
model changes. That would be the first thing i would check if the bindings are
already applied. I had once a bug where the bindings were executed after the
selection changed which caused the list to be the same in that moment. If you
can supply some code, i can try to give you some help debugging it.
Best,
Martin
Am 23.09.2010 um 21:35 schrieb John Spackman:
Hi guys,
I've derived a class from qx.ui.form.ComboBox and implemented the
qx.ui.core.ISingleSelection and qx.ui.form.IModelSelection interfaces so that I
can use a qx.data.controller.List to bind the drop down to data fetched from
the server; the idea is that the ComboBox is used for incremental type-ahead
style lookups, where if the user pauses long enough between keystrokes it goes
back to the server to get a new list of items to go in the ComboBox's drop-down.
Everything works fine, except when I get a second lot of data from the server
and set it as the new model for my qx.data.controller.List - it tries to
preserve the selection but fires changeSelection with the wrong model element.
AFAICT, qx.data.controller.List._applyModel sees that the new model is longer
and extends the list of ListItems, setting each ListItem's model property to
the appropriate element from the new model. However
q.d.c.List._changeTargetSelection (from q.d.c.MSelection) tries to preserve the
selection based on that of the target, but that just means that if the n-th
item was selected before then the n-th item will be selected afterwards even if
the model has completely changed underneath it.
I'm not sure this is clear, so for example: if the 1st model is [ 'a', 'b', 'c'
] and you select 'a' and then apply a new model with [ 'z', 'a', 'b', 'c' ]
you'll get a changeSelection event where the new selection is 'z'.
Preserving the selection based on array index doesn't make sense – q.d.c.List
should either erase the selection when a new model is applied, or (ideally) use
some form of comparator (or easily overridden method) to copy selection between
before and after.
Have I missed something? If not, I'd like to suggest that
q.d.c.List._applyModel passes the previous selection to
q.d.c.MSelection._changeTargetSelection, and then derived classes could
override the re-selection mechanism (I'll write the patch if someone will
sponsor it to commit)
John
<ATT00001..txt><ATT00002..txt>
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel