E
E
Evgeny Zhurov2020-11-12 14:15:25
JavaScript
Evgeny Zhurov, 2020-11-12 14:15:25

How to determine in the component that the document has been printed?

I use Buefy table for data output , and in some places I use table pagination. It is designed in such a way that, for example, the first 50 lines are rendered, and when you switch to page 2, the next 50 lines, etc. The entire array comes entirely from the backend, i.e. moving to another pagination page is NOT a new request to the server.

But now the task is to make print styles for pages with tables so that they can be printed. And in this case, you need to remove pagination and so that the table is printed in its entirety, all, for example, 500 lines. In Buefy, as far as I understand, there is no property that determines that the document has been printed. I suppose you can somehow determine this in js - that the window.print () function was launched, but I don’t know how, in fact, to determine this inside the component. Then it would be possible to set some kind of dynamic parameter by which to determine that the document is being printed and display the entire table.

Or maybe there is some other solution for a similar situation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey P, 2020-11-12
@Zhuroff

There are multiple onbeforeprint & onafterprint events , subscribe to these events.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question