Rowgroup and excel export. How to keep different columns

Rowgroup and excel export. How to keep different columns

itajackassitajackass Posts: 162Questions: 48Answers: 3

Hi i modified this usefull script ( https://live.datatables.net/mucewuca/6/edit ) to my needs:
- rowgroup keeping ALL the columns (instead a only one colspan)
- rowgroup with one cell for the "total of: ...." and one dedicated to sum
- only one sheet

I don't find the piece of code where modify to get rowgroup keeping all columns. Any ideas? thanks

here my modified script: https://live.datatables.net/mucewuca/9/edit

This question has an accepted answers - jump to answer

Answers

  • itajackassitajackass Posts: 162Questions: 48Answers: 3
    edited August 7

    update: after a lot of code removed, i get my goal, but I think i've stripped TOO MUCH USEFULL code :neutral:

    https://live.datatables.net/mucewuca/10/edit

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    edited August 7

    Yes, that example has a lot of code to provide flexibility but that makes it complex. If you don't need that level of flexibility then remove what you don't need :smile: It's easier for troubleshooting at a later date.

    Kevin

  • itajackassitajackass Posts: 162Questions: 48Answers: 3

    I think your original code will be perfect if here:

    table.rows(selectorModifier).every( function ( rowIdx, tableLoop, rowLoop ) {
       var data = this.data();
        ...
     }
    

    "this.data()" can retrieve also programatically added rows, like in endRender function. In this case, grouped rows are already done to be added to excel. Any change to add a parameter to get also the grouped rows? like for example: this.data(['retrieveGroupedRows': true])

  • kthorngrenkthorngren Posts: 21,299Questions: 26Answers: 4,945
    Answer ✓

    RowGroup directly inserts the startRender and endRender rows into the tbody. This only happens for the rows shown on the page. startRender and endRender are not generated for pages not displayed. Plus there are no Datatbles API's to fetch startRender and endRender. That is why the example generates them on the fly.

    Kevin

Sign In or Register to comment.