locked
Prevent update of WinJS ListView if underlying filtered list has not really changed

    Question

  • Given this code:

    var mainList = new WinJS.Binding.List(["one", "two", "three"]); var filterString = "t"; function filter(item) { var result = item.indexOf(filterString) > -1; console.log("Filter: " + item + " " + result); return result; }; var filteredList = mainList.createFiltered(filter); filterString = "e"; mainList.notifyReload();


    I created a listview and input field. The listview should update when I type in the input field.

    So I call mainList.notifyReload in the inputs.oninput event handler. That makes the listview refresh itself, even when the content it has to display according to the filtered list did not changed between inputs in the input field.

    Is there another way than calling notifyReload? maybe a method to re-evaluate the filter instead of suggesting a list reload?

    Friday, April 04, 2014 10:38 PM

All replies

  • Why is this causing problems?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, April 07, 2014 7:29 PM
    Moderator
  • It's disturbing for the user to see the listview UI refresh when nothing has actually changed. Its just visual "problems". Coming from glazedlists from java, they have the same filter/sorting chaining, but the UI only actually refreshes if there are additions/removals in the resulting dataset. Very smooth UX.
    Monday, April 07, 2014 7:36 PM