DataTables logo DataTables

via Ad Packs
Problem combining column sorting, row grouping and hidden row details
  • nunonuno
    Posts: 14
    Hi!

    I'm trying to combine all these features but it's not working correctly.
    The table detail rows start by being collapsed. If I expand the last row of a group and then click sorting twice it expands correctly but after the sorting the details row ends up going into the next group.

    My code for the row grouping is very similar to the one in the example:

              "fnDrawCallback": function ( oSettings ) {
                  if ( oSettings.aiDisplay.length == 0 ) { return }
    
                  var nTrs = $j('#fleet_datatable tbody tr:not(.family)')
                  var iColspan = nTrs[0].getElementsByTagName('td').length
                  var sLastGroup = ""
                  for (var i=0;i<nTrs.length;i++) {
                      var iDisplayIndex = oSettings._iDisplayStart + i
                      var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0]
                      if ( sGroup != sLastGroup ) {
                          var nGroup = document.createElement( 'tr' )
                          nGroup.className = "family"
                          var nCell = document.createElement( 'td' )
                          nCell.colSpan = iColspan
                          nCell.innerHTML = sGroup + ' family'
                          nGroup.appendChild( nCell )
                          nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] )
                          sLastGroup = sGroup
                      }
    

    The problem seems to be the insertion point of the group row...
  • badeabadea
    Posts: 16
    Hi Nuno !

    Have you solved this problem ? I have the same issue.
  • nunonuno
    Posts: 14
    Hi!

    No, I ended up dropping the grouping of rows as it seemed to be difficult to integrate with the other plugins.

    Cheers,
    nn

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Support

Get useful and friendly help straight from the source.

In this Discussion