How to delete a item for custom datasource of listview? RRS feed

  • Question

  • I've been trying to get a WinJS.UI.ListView to work with a custom data source and I have followed the instructions here. But both the samples and instructions did not tell how to add or delete a item in customize datasource. Could you kindly help me? Thanks very much.

    Friday, June 8, 2012 9:52 AM


  • Hi

    Does this isn't your need?


    I think this codes had show you how to delete a item in customize datasource.

    function removeSelected() {
            // Get the control, itemDataSource and selected items
            var list2 = document.getElementById("listView3").winControl;
            var ds = list2.itemDataSource;
            if (list2.selection.count() > 0) {
                list2.selection.getItems().done(function (items) {
                    // Start a batch for the edits
                    // To remove the items, call remove on the itemDataSource passing in the key
                    items.forEach(function (currentItem) {
                    // End the batch of edits

    Monday, June 11, 2012 3:12 AM