New RowsGroup plugin: merge cells vertically (rowspan) - Page 2

New RowsGroup plugin: merge cells vertically (rowspan)

2»

Replies

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    This thread is specifically concerned with the RowGroup feature. Is that what you need?

  • jithinwilfredjithinwilfred Posts: 4Questions: 1Answers: 0

    Is it possible to group based on data attribute (such as data-group="subgroup1") like that.
    My requirement is to hide the group data on data attribute and show a different text on table cell, thanks

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    No, HTML5 data attributes aren't currently supported.

  • joseph123joseph123 Posts: 1Questions: 0Answers: 0

    Hi
    How to add border after merged row completed

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Is it possible to group based on data attribute (such as data-group="subgroup1")

    Would you have an attribute per cell? Or per row. Either way, at the moment it isn't possible, but it something like something that might be worth exploring as an option if you could provide more information about how to plan to use it. Until then, you'd need to use rowGroup.dataSrc to point to somewhere in the data source object that contains the grouping information.

    How to add border after merged row completed

    Can you show me a mock up picture of what you mean please?

    Allan

  • BhavinBhattBhavinBhatt Posts: 27Questions: 9Answers: 0
    edited January 2020

    It works like a charm.
    But there's one issue.
    I am using rowGroup also to summarize group totals at the bottom.
    the issue is in endRender function of rowGroup.
    It puts <td> of totals with colspan twice when the page loads first time..
    Please help me out.
    Example:

    $('#myTable').DataTable
    (
                   [bla bla bla]
                   rowsGroup:[0,1],
                   rowGroup: 
                                   {
                                             startRender:null,
                                             endRender:function(rows,group)
                                             {
    var tQty = rows
                                                                .data()
                                                                .pluck(3)
                                                                .reduce(function (a, b) 
                                                                 {
                                                                    return a + b.replace(/[^\d]/g, '') * 1;
                                                                }, 0) ;
    
                                                            
                                                                return $('<tr/>')
                                                                    .append('<td colspan="3" align="left" class="grpApplied" >' + group + '- Total: ' + '</td>')
                                                                    .append('<td align="right">' + tQty + '</td>')
                                             }
                                   },
    dataSrc:[0]
    ); 
    

    Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • BhavinBhattBhavinBhatt Posts: 27Questions: 9Answers: 0

    when page loads first time, it shows two rows of totals comes because of endRender.
    when User Searches, it shows only once.

  • FredaFreda Posts: 1Questions: 0Answers: 0

    Thank you for sharing. This is very helpful for me.

  • jc0814jc0814 Posts: 1Questions: 0Answers: 0

    works perfectly ! thanks !

Sign In or Register to comment.