Executing JavaScript functions from JasperReports from within JasperReports Server using community free edition.
I wanted to add a button to my jasper report. when clicked on it, it executes a Javascript which updates the DB.
Is this possible using jaspersoft community edition?
1 Answer:
Hi siddhi_doshi,
This is a trick one, you need to do a couple of things.
So when the report is generated in the jaserpserver it is generated in an html doc.
So you could add a text box on the report that is a place holder for the button.
Then assign these properies with values to the text box.
net.sf.jasperreports.export.html.class
net.sf.jasperreports.export.html.id
Now you have an id and a class name you may make use of.
So you can then add css to it, i.e hover over change color or something.
You can add an function to it etc.
So now the question of scripts.
You can make use of net.sf.jasperreports.export.html.footer or net.sf.jasperreports.export.html.header to inset html, which in this case you can make use of a script tag.
Another option would be to make use of custom jsp for a report.
So when you upload a report in the jasperserver or edit a existing one. The last vertial tab option. You will need to read up on implementation of it in their official documentation.
Customization
Locate a custom report view.
User Inputs :
Name and DescriptionJSP Location:(within /WEB-INF/jsp)
Hope this all help.
Good luck