How to Re-Order WinJS Groups RRS feed

  • Question

  • I am using a WinJS.Binding.List which puts my items into groups and then sorts the group using the groupsorting function:

                        function groupKeySelector(projectItem) { return projectItem.subgroup; },
                        function groupDataSelector(projectItem) { return currentProject.subgroups[projectItem.subgroup]; },
                        function groupSorter(first, second) {
                            if (first === second) {
                                return 0;
                            } else if (currentProject.subgroups[first].pos < currentProject.subgroups[second].pos) {
                                return -1;
                            } else {
                                return 1;

    The users can easily update the column order in the app but what I am looking for is an easy way to notify the list to re-order its groups, the only way I can find is to re-call the whole function.

    Thursday, July 31, 2014 10:12 AM

All replies

  • Hi - Why wouldn't you want to just recall your sorting function? No matter what method you ultimately find, there's some processing that it going to take place to make the sort happen again.

    I assume that this is the sort from the documentation, right?

    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.

    Thursday, July 31, 2014 1:20 PM
  • I am using this: http://msdn.microsoft.com/en-us/library/windows/apps/hh700742.aspx 

    ..and then sorting the lists using the "groupSorter" function

    I can just call the function but in some cases where I have >200 items it seems like a waste when I know I want to swap columns 2 & 3 (for example)

    Friday, August 1, 2014 12:34 PM