Reputation: 1
I have a similar problem here. I have a page which accepts 3 parameters. i enter the parameters and the control goes to the list action. The list action has the code to query db and get the data on list.gsp page. Now when i hit "download to excel" on the same page, i want the same list action to get triggered and the same query to be run. However, when I click on "export to Excel", control goes to the list action, but the data that i had entered for my query to run is now null. The form elements have not been retained. Please help.
I am using the export plugin
Upvotes: 0
Views: 1739
Reputation: 33335
Pass the same parameter values back to the controller when the export button is clicked, send them back to the page as "listParams"
[ bookInstanceList: Book.list( params ), listParams: params ]
I might also suggest that you have a different action handle the click on the export button since you really do not want to list the data, you want to export it.
The formats tag supports the following attributes and allows you to pass through HTML attributes:
http://www.grails.org/plugin/export
<export:formats params="${listParams}"/>
Upvotes: 1