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

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

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

Post by a.gneady » 2015-09-30 07:48

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.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply