locked
How to use "createGrouped" and "groupDataSource"... RRS feed

  • Question

  • The examples are nice, but not very "real world", e.g. data is just made from arrays with fruit names.

    Not in my .js I have this(only the main pieces of course):
    // Here are two lists...
    var categoryTiles = new WinJS.Binding.List([]);
    var categoryGroupedList = new WinJS.Binding.List([]);

    // In the binding code we have this....bind the ListView, and set the group list:
    theListView.itemDataSource = categoryTiles.dataSource;
    categoryGroupedList = categoryTiles.createGrouped(getGroupKey, getGroupData, compareGroups).groups;

    And here is the ListView:
    <div id="Category_All_Products_Items" class="category-all-contents" data-win-control="WinJS.UI.ListView" data-win-options="{
      itemDataSource: categoryTiles.dataSource,
      itemTemplate: ItemBoxTemplate,
      selectionMode: 'none',
      groupDataSource: categoryGroupedList.dataSource,
      groupHeaderTemplate: headerTemplate,
      layout: {type: WinJS.UI.GridLayout}
    }">

    It seems to die in the groupDataSource's datasource peoperty....seems to be undefined.

    Any tips?

    Thursday, June 7, 2012 10:14 PM

Answers

  • Try setting the itemDataSource to categoryGroupedList.dataSource and the groupDataSource to categoryGroupedList.groups.dataSource.
    • Proposed as answer by Marcus Ilgner Thursday, June 21, 2012 8:36 AM
    • Marked as answer by Min ZhuMember Tuesday, July 3, 2012 5:51 AM
    Wednesday, June 13, 2012 11:27 AM