locked
notifyMutated list order

    Question

  • I am using list.notifyMutated(i) to update my winJS list items which updates its value and moves its position. The issue is this new position isnt behaving properly. If I then update another item with list.notifyMutated(i) the item will dissapear and there will be a blank spot where the item should be.

    When investigating further I can see that when i call list.notifyMutated(i) and move an item the new position isnt being properly recorded by the list. If i inspect "list._groupedItems" the order of the items are in the old order.

    When i updated item properties before I was deleting the item and then re-adding it. But I was looking for a more elegant method and though the list.notifyMutated() looked like my solution but I am still trying to iron out this issue.

    Thanks 

    EDIT:

    Using listView.forcelayout(); does fix the issue however this is very undesirable because when i spliced the item then re-added it the listview displayed a nice animation of one item dropping out and another one dropping in while forcelayout makes the whole page jump

    • Edited by r.c.byrne Tuesday, May 13, 2014 2:32 AM
    Tuesday, May 13, 2014 1:52 AM

All replies

  • I have managed to find the cause of the issue. Initially i was looking down the wrong route, assuming I had to pass some extra binding information to the listview however it was actually due to "returning" the item in a function. When i was splicing and pushing items to update them I would pass the item to a function, do some calculations and then return it, before splicing the old item pushing the updated version. 

    Even though I have fixed the issue, if anyone has some insight to why this would cause issues I would be interested to know more

    Tuesday, May 13, 2014 11:18 AM