1. Fabrik 3.8.1 has been released. It is mostly bug fixes and feature enhancements, but does include two new plugins (push notifications, and the sequence element). As usual we strongly recommend testing the new release on a sandbox if your application is mission critical, and always do an Akeeba backup before updating.
    Dismiss Notice

Export to CSV without using dialog

Oct 22, 2016
Export to CSV without using dialog

  • Fabrik 3.0 +(top)


    You should use the CSV Fabrik menu item type.

    In addition, starting from Fabrik 3.3.4 you can also use the URL:

    index.php?option=com_fabrik&view=list&listid=listid&format=csv&download=1


    Fabrik 2.0 only:(top)


    If you don't want to show the CSV export dialog then you can achieve a direct export to CSV by adding this into your table template. Templates are found in components/com_fabrik/views/table/tmpl
    PHP:
    <?php $url = "index.php?option=com_fabrik&c=table&view=table&format=csv&tableid={$this->table->id}&task=viewTable";?>
    <span class="csvExportButton custom">
    <a href="javascript:oPackage.blocks.get('table_<?php echo $this->table->id;?>').triggerCSVImport(0, <?php echo $url'?>);">Export as CSV</a>
    </span>
    You can append variables to the$url value to alter the output of the CSV file. These correspond with the settings located on the export CSV dialog box:
    • incraw=0 or 1
    • incfilters=0 or 1
    • inctabledata=0 or 1
    • inccalcs=0 or 1
    • excel=0 or 1
    By default this will export all of the table's elements. If you want to specify which element's are exported append the following the url:

    Code (Text):
    &fields[tablename___elementname]=1&fields[tablename___elementname2]=1
    Note the span's 'custom' class is obligatory, as it stops the default export dialog from opening