Thanks T.,
This sounds like it may do the trick. For the record, I'm not fooling with
'__data' and '__value' (directly, anyway), just  observing what qooxdoo
stuffs into those members; for instance the deprecated 'setValue()' routine
sets the __value member. I expect that the event 'e' was obtaining '1234'
from the __value in my ListItem, and when I no longer set the item's
__value, 'e' defaulted to picking up the item's name ('baked beans')
instead.

I'll change my listener to the different event and see what I get back. For
the record, this (get/setUserData) seems like a much better way of doing
things than the old set/getValue(), just a bit confusing as to how to
migrate to the new way of doing things.
Ken

On Fri, Dec 4, 2009 at 11:49 AM, thron7 <[email protected]>wrote:

>  Ken,
>
> I'm not sure I fully get what you are doing, but here is a hint.
>
> First off, you should change the event you are listening on to
> 'changeSelection', I think this is what you're after. Then, the event object
> passed to your event listener will carry the ListItem widget(!), not any
> scalar value like a string or number. So with e.getData() you should get the
> newly selected ListItem, and e.getData().getUserData() should provide you
> with 1234. (I'm not sure what it means when you're fiddling around with
> private members like __data).
>
> HTH,
> T.
>
> Ken MacDonald wrote:
>
> Hi,
> I'm trying to de-deprecate my qooxdoo app (get rid of all the deprecation
> warnings). Most of them are around get/setValue() calls and Lists/ListItems
> I'm working with. Previously I was constructing ListItems something like
> this:
>
> // item has __value field set to '1234'
> item = new ListItem('baked beans', null, '1234')  // '1234' is the recipe
> id for 'baked beans'
> mylist.add(item)
>
> and then I add a listener to the list:
> mylist.addListener('changeValue', listchangeroutine)
>
> but __value is deprecated in favor of setting userData...
>
> so I changed to something like this (this is all kind of pseudo code, I
> don't have the real code handy right now):
> item = new ListItem('baked beans', null)
> item.setUserData('recipeid', '1234')
> mylist.add(item)
> and add listener, etc.
>
> the problem comes in my listener function:
>     listchangeroutine: function(e)
>     {
>         var value = e.getData();
>
> before I changed the code, when I selected the item from the list, the
> event 'e' yielded value = '1234', which is in its __data member.
>
> After the change, 'e' now has the value 'baked beans' in the __data member,
> and no __userData at all, so I haven't been able to get the recipeid that I
> need. Is there any way to find out what ListItem was selected so that I
> could do a getUserData('recipeid') on it, or some way to coerce the event
> data to have the info I need? Any suggestions welcome.
> Ken
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. 
> Anywhere.http://p.sf.net/sfu/redhat-sfdev2dev
>
> ------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing 
> [email protected]https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to