Page 1 of 1

Detecting the print preview mode of a specific table in hooks/footer-extras.php using JavaScript

Posted: 2015-09-30 07:48
by a.gneady
Hello all,

I was working on some customized code for a client and needed to add some JavaScript code in the hooks/footer-extras.php file that will be executed only in the table-view print preview mode for a specific table. So I needed to detect this through JavaScript. The code I used is:

Code: Select all

/* detect table view print preview mode of table 'items' */
if($j('#sendToPrinter').length && window.location.href.match(/\/items_view\.php/) != null){
   /* code to execute in the table view print preview of the items table */
}
The table in the above code is named 'items'. So, you should change it to match your table name. The above code should work with AppGini 5.40 and newer.