Clone wiki

grails-datatables / reportFunction



Name Type Default
reportFunction String None


reportFunction is a table option that allows you to specify the name of a custom JavaScript function that will be called when the Download Report button is pressed. If this function is not set, then clicking the Download Report button will immediately start the report download. This function is useful in cases where you need to perform some interaction prior to beginning the report download, or when you wish to download the report in a special way, such as with jquery.fileDownload.

Your function will be passed the clickEvent, the number of filtered records in the table, and the report URL.


<dt:datatable name="MyTable" domainClass="" serverSide="true" reportButton="true" reportFunction="downloadReport">
    <dt:column name="myFirstProperty"/>
    <dt:column name="mySecondProperty"/>

<script type="JavaScript">
    function downloadReport(clickEvent, numRecords, reportUrl) {
        // Do the download *my* way.

See Also

reportingEnabled, reportButton

Back to Options.