Print some rows add with jquery append function

Print some rows add with jquery append function

ningollanningollan Posts: 6Questions: 2Answers: 0

Hi all,

I have a question :
- I have a dataTable and in the fnDrawCallback function i add a final line with the total of some columns
- When i use the print button (provided in plugins), it only takes the dataTable without my added lines

How can i print those lines ?

Best regards.

Answers

  • colincolin Posts: 9,532Questions: 0Answers: 1,577

    Hi @ningollan ,

    You would use buttons.exportData() - that method is sent the data, which you can then manipulate.

    Cheers,

    Colin

  • ningollanningollan Posts: 6Questions: 2Answers: 0

    Hi @colin

    Thanks for your answer, but i can't see how this method could help me..
    With the row-selector ?

    Cheers

  • ningollanningollan Posts: 6Questions: 2Answers: 0

    I try with this, but the row selector can't find any row with my class myCustomClass)...
    Example :

    1
    1

    And i add this in my dataTable conf :
    'buttons': [
    {
    extend: 'print',
    text: 'Print current page',
    exportOptions: {
    rows: ['.rapportTotal', '.odd']
    }
    }
    ]

    But it only prints the odd line and not all the lines...
    Do you have an idea ?

  • colincolin Posts: 9,532Questions: 0Answers: 1,577

    Hi @ningollan ,

    I went down a different route in the end. My last answer was based on the print button's exportOptions, so a bit misleading sorry. This here does what you want, I believe,

    Cheers,

    Colin

This discussion has been closed.