locked
How to remove an item or items correctly for listview? RRS feed

  • Question

  • I modify "ListView interaction model sample" scenario 1(add to cart) to test remove function of listview.
    Here is the my test code.

    Rewrite scenarioOneAddToCart function as below.

    function scenarioOneAddToCart() {
       var lvObject = WinJS.UI.getControl(id("listView1"));

       // Remove the set of items that are selected.
       var selectedItems = lvObject.selection.getAllIndices();
       for (var i = 0; i < selectedItems.length; i++) {
          lvObject.dataSource.remove(selectedItems[i]);
       }

    }

    The result is not correct after click AddToCart button to remove selected items except the first time.

    How to remove an item or items correctly for listview?

     

     

     


    Aix
    Thursday, January 12, 2012 8:57 AM

Answers

  • Find the solution from "Custom data sources example".
    Aix
    • Marked as answer by aix424 Thursday, January 12, 2012 9:11 AM
    Thursday, January 12, 2012 9:11 AM