Number format of PDF-Export thrown off when reordering

Number format of PDF-Export thrown off when reordering

artmusartmus Posts: 9Questions: 4Answers: 0

Hello,
I'm using ColReorder combined with the pdf-Button. The issue I have is when reordering columns which contain formatted numbers: render: $.fn.dataTable.render.number( '.', ',', 2, '', ' €' ).
In the html-table, the numbers are saved in the following format: <td>1234567.89</td>

As soon as I reorder such columns, the format gets thrown off. For example, in the following test case you can see that by swapping column 'Salary - 1' with 'Salary - 2' and then exporting the file through the pdf-button, the format doesn't match the one from the table.
Using the pdf-Button without reordering these columns works fine though.

Test case: http://live.datatables.net/tuporacu/1/edit

Thanks a lot,
Artur

Replies

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @artmus,

    You can even see the issue if you swap the first two columns, so something very wobbly going on. Thanks for the test case. I've logged it in our internal system (DD-886 for my reference), and I'll report back here when it's been progressed.

    Cheers,

    Colin

  • artmusartmus Posts: 9Questions: 4Answers: 0

    Thanks once again for your help, colin! I hope to hear from you soon.

    Greetings from germany,
    Artur

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    I've just been looking into this and the issue is the way ColReorder is telling the DataTable to update the shuffled data. It will do a rows().invalidate(). Normally that is okay, but when using a renderer it means that the data being written to the DataTable is the already rendered data!

    We need to rewrite ColReorder to have it not manipulate the original data array, but rather just change where it is reading the data from for each column.

    That's not going to make it into our current release cycle I'm afraid, but I know what needs to be done with it (probably a day or two's work).

    Allan

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    For anyone who stumbled across this discussion, this has been resolved in ColReorder 2 (a rewrite which implements the changes I intimated at above). CR2 will ship in January next year along with DataTables 2 and other extensions.

Sign In or Register to comment.