Print functionality on button click

Print functionality on button click

  

Hi all,

I need to print the report page. i am using (window.print(); return false;)  in the extended properties of the button. I am also using the media query in the CSS of the report page but there is no response after button click. can anyone tell how can i get this done? i am using media queries to avoid header and footer but the button click didnt through any response after click.

any help will appreciated.

Kind regards

Hello Hassan I think you can use a component from forge that do it for you with more elegance. Take a look at these components:

  1. https://www.outsystems.com/forge/component/1414/simple-reports/
  2. https://www.outsystems.com/forge/component/209/html2pdfconverter/

Hope this helps.

Solution

Hi Hassan,

Besides using something more elegant, if possible, I would like to add that the extended properties of a widget are for add atributes to the HTML element used. 

If you wants to run javascript, the standard way in OutSystems can be seen here: https://www.outsystems.com/forums/discussion/18166/how-to-call-javascript-function-on-button-click/

Cheers.

Solution

Alexandre Costa wrote:

Hello Hassan I think you can use a component from forge that do it for you with more elegance. Take a look at these components:

  1. https://www.outsystems.com/forge/component/1414/simple-reports/
  2. https://www.outsystems.com/forge/component/209/html2pdfconverter/

Hope this helps.

hi alexandre, 

thanks for the reponse but that didn't worked for me. I have checked them.

is there any other solution without using the forge components like jquery, javascript or using the media queries in a right way? i dont have permissions to install the components into espace.

thanks

Eduardo Jauch wrote:

Hi Hassan,

Besides using something more elegant, if possible, I would like to add that the extended properties of a widget are for add atributes to the HTML element used. 

If you wants to run javascript, the standard way in OutSystems can be seen here: https://www.outsystems.com/forums/discussion/18166/how-to-call-javascript-function-on-button-click/

Cheers.


thanks eduardo,   i was not calling and executing the javascript function. its giving the print preview option now, but i want to avoid the header and footer of the page also. how can i avoid them?

cheers

Hi hassan


Not sure. You can try one of the solutions here: https://stackoverflow.com/questions/8228088/remove-header-and-footer-from-window-print

Or try to google it a little more ;)

Cheers


Hi eduardo, 

yeah i tried this solution. But i dont know how to run the "@media queries" in outsystems. I just wrote the media queries in the CSS of the web screen that needs to be printed but still no effect on the layout while print option.

how can i achieve this?


cheers