Build Post

Single Post Permalink

View Thread: Sub Group For Grid App - JavaScript
  • User profile image

    Hello, I am using the Grid App template to make a JavaScript app but I want to use it with a subtle difference to have an additional sub groups. If the standard structure is Category - > Group I want Category -> Group -> Sub Group. 

    The best way I could think to do this is have two separate grouping structures for my WinJS.Binding.List() one linking Category and Sub Group (for the home page) and one linking Group and Sub Group (for a more in depth look at a group). On the home page i don't want all Sub Groups to show(that is when you go into the groupDetail page) so have created a WinJS.Binding.List() which only has Sub Groups I want.

    So the issue is that when you transition from the Homepage to the groupDetail, as i need to switch structures. I can list.createFiltered to only carry over the Sub Groups I want no problem, but I now cant for the life of my figure out how to regroup them as I need to only show the Groups related to the Category. I need to manipulate the groupDetail.js to get it to group it how I want. This is the specific code which is causing me problems:

    var grouplist = this._items.createGrouped(
    function groupKeySelector(projectItem) { return category.key; },
    function groupDataSelector(projectItem) { return category; }

    this._items are the Sub Groups which I am bringing. group is the Category that we are now in. The data is structured so that the Sub Groups have a link to the Groups which then have a link to the Categories so to target a Category though a Sub Group you would type for example. 

    Please could someone help me group them how I want, sorry if it was confusing I will happily add any information I may have missed out