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