I have created a Jasperreport. It is connected with the database . Now I want one extra column, which can have value on per row basis. Other columns will display the values from the database, but this column will not contain any values after it is being displayed to user. For any perticular row, If user want that this column should have value, user can type the value. So how can I add such field/column in JasperReport, so that user can change it's value at any time. In short I want such Text Box which can be edit by user.
Please, help if anybody already worked on it?
-Thanks in advance.
This is quite interestng.
Will be great to se eif someone has implemeted this already and how ?
From java point of view the report object has been created and the object is displayed as is, so not interaction from user will be possible, beside predefined elements like hyperlink, bookmarks, anchors and html charts.
Also ones approach would be different if working with community or pro edition. The pro edition has it own libarary to interact with report called visualise.js. There might be a way to achieve what you looking for through clever structuring of your design and making use of given elements.
In comuunity edition you would need to dig a bit deep and experiment with trail and error. What I can tel lyou is that you can set jasperstudio to compile the report in javascipt.
This might be your best way forward. One can also intoduce a custom html element. One can also add 3 party js libraries. If you can improve your understanding in these areas, you would be in a better position to come to a suitable conclusion for a solution.
Also you could just generate report in a container and just add you own container next to report container that have the columns rows with html text boxes. The figure away to map the jasper report rows with the html text box rows, then when user select maybe a update button, you could take all these values and pass them as a parameter array via jasper rest api and regenerate the report with given values. The user can double check if correct, before saving or exporting the report.
This won't be possible while just staying within jasper since reports do not allow dynamic input except for parameters but even the input parameter would show up as a prompt and once per report and not per row. What you need is possible but needs a lot of tweaking and adjustment. Perhaps the most likely approach (as suggested by joseng62) is to use visualize.js, pull in all report resources, controls and ouput and then attach a text-box to each row.
And if you are working within a CMS to integrate Jasper reports, making use of iframe elements and adjusting the input component could be another way to go but again it wonn't be a quick job.