locked
Virtualized DataSource and grouping

    Question

  • When working with potentially large datasets, using WinJS.Binding.List.createGrouped or WinJS.UI.computeDataSourceGroups doesn't really scale that well because all items have to be fetched beforehand.

    Unfortunately I couldn't find any documentation on how to implement ones own grouped datasource only that it should contain a 'groups' property which returns an IListDataSource with all the available groups.

    The question here is how these group items should behave, i.e. what properties and methods are required/recommended/available. Looking at the WinJS source, there's references to 'groupKey', 'groupSize', 'firstItemKey' and 'firstItemIndexHint', in another place I see properties 'key' and 'startIndex'.

    Also, is there anything else besides an additional 'groups' datasource, I have to implement? Do the groups themselves need a method to access the items therein?

    Tuesday, April 24, 2012 10:59 AM

Answers

  • Ok, this is what I learned after implementing my custom grouped datasource adapter using the certified "trial and error" method:

    Group items should have the properties key (obviously), firstItemIndexHint and groupSize. In addition to that, the list items should have an additional groupKey property. The adapter for the group datasource is required to implement itemsFromKey, which is optional in a 'flat' datasource adapter.

    Grouping is now working as desired and all is well so far :)

    • Marked as answer by Marcus Ilgner Friday, April 27, 2012 8:45 AM
    Friday, April 27, 2012 8:45 AM

All replies

  • Ok, this is what I learned after implementing my custom grouped datasource adapter using the certified "trial and error" method:

    Group items should have the properties key (obviously), firstItemIndexHint and groupSize. In addition to that, the list items should have an additional groupKey property. The adapter for the group datasource is required to implement itemsFromKey, which is optional in a 'flat' datasource adapter.

    Grouping is now working as desired and all is well so far :)

    • Marked as answer by Marcus Ilgner Friday, April 27, 2012 8:45 AM
    Friday, April 27, 2012 8:45 AM
  • Hi Marcus, I have the same problem, can you help with a little bit more extensive explanation of how do you resolve this?  thanks in advance
    Sunday, August 12, 2012 5:43 PM
  • Hi Hector,

    The Hilo sample app (posted here) contains an example of a custom virtualized data source that implements grouping and semantic zoom. Hope this helps!

    Cheers,

    Marc

    Tuesday, August 21, 2012 11:20 PM