locked
Metro WinJS.UI.ListView Problem RRS feed

  • Question

  • Hi all,

    I am wondering is it possible to limit the size of groupItems in the listview.

    I am using the Grid Project Template, in my data, each group contains hundreds of subitems. I only want to show several of them on the groupitems page and show all of them on the groupdetail page.

    My current idea is to backup my whole items data to another souce and use a limited one as the listview datasource.

    Is there anyeasy way so that I can keep my datasource intact and only one copy? thanks anyway.

    Thanks




    • Edited by ILOVEWCF Friday, July 20, 2012 11:07 AM
    Friday, July 20, 2012 10:48 AM

Answers

  • Hi,

    From my experience, it doesn’t look like an existing property is provided to control how many items to load in each group. It may needs to provide two data sources, one with complete data, and one with fewer data. If the data is loaded from a cloud service, you can first load the small data, and then load each group’s data as user requests.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Monday, July 23, 2012 5:06 PM
    Moderator
  • Hi ,

    Thanks for your response. Anyway my approach is below(did some modification for understanding purpose):

        function prepareItems(callback) {
            var array = new Object();
            var flags = new Object();
    
            sampleGroups.forEach(function (group) {
                array[group.Id] = group;
                flags[group.Id] = 0;
            });
    
            sampleItems.forEach(function (item) {
                item.group = array[item.ParentId];
                flags[item.group.Id]++;
                if (flags[item.group.Id] <= 9)
                    list.push(item);
            });
    
            if (callback)
                callback();
            callback = null;
        };

     It's a small trick when pushing items into the list. Thanks for your time.
    Tuesday, July 24, 2012 2:45 AM

All replies

  • Hi,

    From my experience, it doesn’t look like an existing property is provided to control how many items to load in each group. It may needs to provide two data sources, one with complete data, and one with fewer data. If the data is loaded from a cloud service, you can first load the small data, and then load each group’s data as user requests.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Monday, July 23, 2012 5:06 PM
    Moderator
  • Hi ,

    Thanks for your response. Anyway my approach is below(did some modification for understanding purpose):

        function prepareItems(callback) {
            var array = new Object();
            var flags = new Object();
    
            sampleGroups.forEach(function (group) {
                array[group.Id] = group;
                flags[group.Id] = 0;
            });
    
            sampleItems.forEach(function (item) {
                item.group = array[item.ParentId];
                flags[item.group.Id]++;
                if (flags[item.group.Id] <= 9)
                    list.push(item);
            });
    
            if (callback)
                callback();
            callback = null;
        };

     It's a small trick when pushing items into the list. Thanks for your time.
    Tuesday, July 24, 2012 2:45 AM