Wiki

Clone wiki

grails-datatables / reportFunction

reportFunction

Values

Name Type Default
reportFunction String None

Description

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.

Example

<dt:datatable name="MyTable" domainClass="this.is.my.DomainClass" serverSide="true" reportButton="true" reportFunction="downloadReport">
    <dt:column name="myFirstProperty"/>
    <dt:column name="mySecondProperty"/>
</dt:datatable>

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

See Also

reportingEnabled, reportButton


Back to Options.

Updated