ngTable multi-level or nested grouping
Asked Answered
C

1

8

I am using groupBy in ngTable, but now I need a further level of grouping in the table:

$scope.tableParams = new ngTableParams({
    count: 100,
    sorting: {
        PremiumElementGroup: 'desc',
        PremiumElement: 'desc',
        LegalEntity: 'asc',
        SettlementCurrency: 'asc'
    }
}, {
    counts: [],
    groupBy: 'PremiumElementGroup' <--- only allows one level of grouping...
    , getData: function ($defer, params) {
        var orderedData = $filter('orderBy')($scope.section.PremiumCessionOverrides, params.orderBy());
        $defer.resolve(orderedData);
    }
});

Is there something I can do to achieve what I want? Or another grid tool I could use?

Corgi answered 6/11, 2014 at 15:8 Comment(2)
maybe using callback in groupBy property?Janeanjaneczka
@KostiaMololkin I had a look at the callback example, it seems to be setting groupby to the return value of some function. How would this help me acheive multi-level grouping?Corgi
S
5

So far, there doesn't seem to be the possibility for group nesting up to multiple levels using ngTable.

However, you can use UI Grid which, according to their documentation allows nesting up to multiple levels.

At one example, their documentation says:

SubGrid nesting can be done upto multiple levels..

Side-note: You are asking for multi-level grouping or nested grouping where the title of the question is a bit misleading.

Sauropod answered 31/1, 2015 at 13:21 Comment(5)
Thanks for that - you are correct, strictly I am asking about multi-level/nested grouping. I have changed title to reflect.Corgi
@TomRedfern have you successfully implemented Expandable UI Grid with more then 2 or 3 levels. If yes please share plunker or fiddle or detailed explanation would be really helpful!Raccoon
@Raccoon - sorry to tell you I was not successful and had to create my own solution for this in the end, just using multiple level nesting of ng-repeat.Corgi
@TomRedfern it would be really helpful if you share the solutions. I tried in ng repeat but i cant able access the scope in that template fileRaccoon
@Raccoon - apologies it was in my last job so I can no longer access that source code...Corgi

© 2022 - 2024 — McMap. All rights reserved.