Chain RowGroup API

Chain RowGroup API

tablegeektablegeek Posts: 1Questions: 1Answers: 0
edited December 2019 in Free community support

Hi There
I have a data table setup as

table = $('#example').DataTable({rowGroup: {
      enable: false,
    },})

I have a click event where which triggers the group as needed from

$('.group-table').on('click', function(e) {
  var column = table.column($(this).attr('data-group'));
  table.rowGroup().enable().dataSrc((groupBy)).draw();
 });

I would like to add .startRender() to the above chain and have a few updates that I would like to make.
So the code could look

table.rowGroup().enable().dataSrc((groupBy)).startRender(function(e,t){
// my code here
}).draw()

But when I try to execute it I get that startRender is not a function. I'm looking for a correct way of targeting startRedner as chain method rather than

$('#myTable').DataTable( {
    rowGroup: {
        startRender: function ( rows, group ) {
            return group +' ('+rows.count()+' rows)';
        }
    }
} );

Answers

  • kthorngrenkthorngren Posts: 21,166Questions: 26Answers: 4,921

    Have you tried combining the options?

    $('#myTable').DataTable( {
        rowGroup: {
            enable: false,
            startRender: function ( rows, group ) {
                return group +' ('+rows.count()+' rows)';
            }
        }
    } );
    

    I haven't so not sure it will work but suspect it will.

    Kevin

This discussion has been closed.