rowGroup delete/hide group

rowGroup delete/hide group

jtislerjtisler Posts: 2Questions: 1Answers: 0

Hello folks,
is there any way to delete/hide whole group within startRender function?

rowGroup: {
            dataSrc: 'name',
            startRender: function (rows, group) {
                var issuedTotal = rows
                    .data()
                    .pluck('issued')
                    .reduce(function (a, b) {
                        return a + b.split(' (')[0] * 1
                    }, 0);

                var activatedTotal = rows
                    .data()
                    .pluck('activated')
                    .reduce(function (a, b) {
                        return a + b * 1;
                    }, 0);

                if (issuedTotal === activatedTotal) {
                    // delete all rows that belongs to group here
                    rows.remove(); //removes some rows but not all
                    return $('<tr class="hidden"/>') //i've managed to hide group "header" row
                    //return $('<tr/>').append('<td colspan="4">' + group + '</td>');
                } else {
                    return $('<tr class="danger" style="color: #34495e; font-weight: normal;"/>').append('<td colspan="4">' + group + ' <b>issued = ' + issuedTotal.toFixed(2) + ', activated = ' + activatedTotal.toFixed(2) + '</b></td>');
                }
            }
        }

Answers

  • jtislerjtisler Posts: 2Questions: 1Answers: 0

    After more digging and debugging I've found solution, maybe it will help someone

    $(rows.nodes()).each(function(){
        $(this).remove();
    });
    
This discussion has been closed.