How to automatically print a page popup in Rollbase

Posted by gonzales.pgon@gmail.com on 12-May-2014 08:16

Hi 

I am pretty sure that rollbase has a built in print function. Click it would open a popup window where we could print the page itself. Im trying to implement a link from my view Receipts page ( Receipts is my object) to automatically print the popup window. I manage to automatically link the popup window already. Is there a way to edit the onload function of the popup page so that i could have my print function run automatically?

Thank you for all the help

All Replies

Posted by Santosh Patel on 15-May-2014 00:46

Some Javascript code that might serve your purpose. We are basically overriding the rbf_openPopup function to return the popup window handle and do a print directly.

The code should be added to the application header and footer if you want it across your application or on page specific headers (say to only do print receipts automatically)

var printReceipts = function(query) { var popup = window.open('../m/popup.jsp?'+query,'pageView','WIDTH=650, HEIGHT=600, RESIZABLE=YES, SCROLLBARS=YES, TOOLBAR=YES, MENUBAR=YES, LEFT=20, TOP=20'); popup.focus(); popup.print(); return false;}
var toReplace = $('i.icon-print').parent().attr('onclick').replace('rbf_openPopup','printReceipts');
$('i.icon-print').parent().attr('onclick',toReplace);

This thread is closed