2 issues with Print Button
2 issues with Print Button
Link to test case: https://live.datatables.net/kotupagi/1/
Error messages shown: buttons.print.min.js:5 Uncaught TypeError: b.open is not a function
at _Api.action (buttons.print.min.js:5:1556)
at action (dataTables.buttons.js:769:19)
at HTMLButtonElement.<anonymous> (dataTables.buttons.js:790:7)
at HTMLButtonElement.dispatch (jquery-3.4.1.min.js:2:42571)
at v.handle (jquery-3.4.1.min.js:2:40572)
Description of problem: It appears the print button is throwing an error in this minimally reproducible DataTables JS Bin.
I was trying to create a new bin so I could reproduce an issue and encountered this issue first.
The additional issue, which is also reproducible on the Print Button example, is this:
- Click Print
- Close the New Tab at the top of the browser (do not use Save/Cancel options in the dialog).
- On the example page again, try to click into the Search box on the table. It will not be clickable.
- Other options like sorting and pagination are functional.
You have to click out of the browser, or open a new tab or some other type of action to be able to click back to the page and select the Search box.
This does NOT occur if you disable the auto print initially. Then bring up the print dialog and close the tab at the top the same way. You can click right into the Search box, no issue.
This question has an accepted answers - jump to answer
Answers
I tried the test case and don't see the error. I used Chrome on a Mac.
I did not see the second issue with Chrome on the Mac. I closed the tab and was able to perform searching of the table.
What OS and browser versions are you using that causes these errors?
Kevin
I'm seeing it on Ubuntu/Chrome when following those steps, thanks for the good description, so one of those joyful platform dependent issues! I've raised it internally (DD-2681 for my reference) and we'll report back here when there's an update.
Colin
Thanks Kevin and Colin.
I tried on a Windows 10 Enterprise with both Edge (Version 115.0.1901.183) and Chrome (Version 115.0.5790.110) browsers
Looks like a Chrome / Blink bug to be. I've just recreated the issue without any DataTables code in this example.
Rather oddly, doing exactly the same in JSFiddle and it does work!
Doing it in its own standalone file and the bug crops up again. That it works in JSFiddle must be something to do with the
iframe
being used.Allan
I found this Chromium bug which details exactly this issue. I've added the test cases I created from above.
Allan
Nice find Allen! It's at least 4 years old according to that bug report date. Probably not high on any priority list since the user can click one of the print dialog buttons and avoid the issue. Or as I said in dataTables cases, by setting autoPrint = false and just letting the user bring up the dialog themselves.
They've got it as priority 1 and multiple milestone targets. I suspect it's just been forgotten about... My post there was as much a bump as anything else to be honest.
Allan