locked
Selection disappears when recycling an item renderer element in ListView

    Question

  • Hello,

    I'm experiencing some strange behavior that I think might be a bug:

    I have a WinJS.UI.ListView that uses an item renderer function to display individual items. When I select an item, a selection border appears as expected. Now I change the underlying element in the data source. The item renderer is called again, with the current item element as second parameter -- so it can be "recycled". The item renderer updates the item correctly. However, the selection border disappears unexpectedly, even though the element is technically still selected. This becomes obvious when I select another item in the ListView: In addition to the new selection border for the newly selected item, the selection border for the original item reappears.

    Since the issue is a little hard to describe in words, I built this minimal working example.

    Is this behavior intentional or is it a bug? What can I do to work around it?

    Thursday, May 03, 2012 10:00 AM

Answers

  • Hi G,

    I confirmed this is a bug and it appears that it is fixed in a later build.  The only workaround I can think of is to wait for the fix, or don't use recycling until after you verify the fix in a later build.

    -Jeff


    Jeff Sanders (MSFT)

    Friday, May 04, 2012 1:42 PM
    Moderator

All replies

  • Thanks for the sample!  I will take a look at this and report back.

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, May 03, 2012 11:34 AM
    Moderator
  • I was able to repro this behavior.  I have engaged the dev team and will notify you if I find a solid workaround for you!

    -Jeff


    Jeff Sanders (MSFT)

    Thursday, May 03, 2012 6:54 PM
    Moderator
  • Hi G,

    I confirmed this is a bug and it appears that it is fixed in a later build.  The only workaround I can think of is to wait for the fix, or don't use recycling until after you verify the fix in a later build.

    -Jeff


    Jeff Sanders (MSFT)

    Friday, May 04, 2012 1:42 PM
    Moderator