Problem while using PRINT button - tab might be closed in Chrome and Edge

Problem while using PRINT button - tab might be closed in Chrome and Edge

DmitryRDmitryR Posts: 1Questions: 1Answers: 0

Description of problem:
I use Datatables version 10.0.16 and Datatables.buttons 1.2.2

When I press print button new tab is opened and table data is tried to be rendered.
First I see data is displayed with unexpected font - then css is applied and data is fine.
The problem that this tab is closed before Chrome print popup is opened.
Sometimes everything is ok - I see new tab, table data and Chrome print popup is opened.

If I set autoPrint config to false - there is no problem.
New tab is opened, table data is displayed fine.

I was thinking the problem is I have too much data to print.
But then I reproduced same issue with small table.

For now I created custom print type - using code from button plugin 1.2.2 and set timeout to 1000 before calling print().
And it is better - but sometimes new tab is closed.

NOTE: Issue is reproduced only for Chrome and Edge.
In FireFox everything is fine.

I wonder what is the problem and how to solve it.
Thanks in advance!

Answers

  • kthorngrenkthorngren Posts: 21,315Questions: 26Answers: 4,948
    edited October 18

    Buttons 1.2.2 is very old. According to the Release notes it was release in 2016. My recommendation is to upgrade to a more recent version. Datatables 2 was recently released. That is the recommended path as Datatable 1.x isn't expected to receive fixes. However if you want to stay with 1.x then use the legacy download builder to get teh latest code for 1.x and Buttons.

    Kevin

Sign In or Register to comment.