views:

527

answers:

1

My TileList has allowMultipleSelection on. I am using itemClick to call a function. I can use listEvent.currentTarget.selectedItem to determine what object was just clicked on if I am selecting, but when I ctrl + click to deselect an item, it automatically selects something else in the TileList, thus changing the selectedItem. It seems like ctrl + clicking to deselect changes the target before the itemClick function is run. Is there a way to figure out what was just deselected?

I can use selectedItems to get the same end functionality I need. However, I am concerned about performance when the selectedItems collection gets really long. We are using blazeds to send the data back and forth and it would be much faster if we sent the one item that was added/removed then the whole thing each time.

+1  A: 

I'm a bit surprised that you seem to be saying that "itemClick" isn't being dispatched in each case. I wonder if you should try listening to the "change" event instead?

What about adding a property called "previouslySelectedItems" and doing a comparison between that and "selectedItems" to figure out what changed? After the comparison is done, set previouslySelectedItems = selectedItems.

cliff.meyers
The itemClick event does get dispatched each time but I can't figure out how to determine what object was just deselected. By the time the event is dispatched, the selectedItem is already something else. I am not sure what I should be using in place of SelectedItem to get the deselected item.
shadenite
I'll do the comparison for now to get the one item, but I was hoping there was something more simple to call that I was missing. Thanks!
shadenite