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

  • 0
    I use Buefy table to display data, 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 moving to 2 pages - the next 50 lines, etc. The entire array comes entirely from the backend, i.e. going 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 for the entire table to be printed, everything, for example, 500 lines. In Buefy, as far as I understand, there is no property that determines that a document is printed. I suppose you can somehow define it in js - that the window.print () function has been run, but I don't know how, in fact, to define it 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.
    JavaScript Anonymous, Feb 16, 2019

  • 1 Answers
  • 0
    There are several events onbeforeprint & amp; onafterprint , subscribe to these events.
    Isla Parker

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!