How to limit PDF/CSV export to max 100 records?

How to limit PDF/CSV export to max 100 records?

fabelmikfabelmik Posts: 2Questions: 1Answers: 0

Hi,

I have a fully functional DataTables setup running, with PDF and CSV export working.
Now, what I can´t seem to work out is a way to set a global limit to the export.
I want to set a limit of 100 records for all exports, meaning that even though there are 1000 results sorted the user must only be able to export a max total of 100 record (the first 100 out of the 1000 total records)

How do I do this?

Answers

  • fabelmikfabelmik Posts: 2Questions: 1Answers: 0

    Here is a snippet of my current JS setup:

    jQuery('#example').dataTable( {
            "ajax": "/mylocation/json.txt",
            "deferRender": true,
            "language": {
                "lengthMenu": "_MENU_ resultater per side",
                "zeroRecords": "Ingen resultater fundet",
                "info": "Viser _END_ ud af _TOTAL_ resultater",
                "search": "Filtersøgning",
                "infoEmpty": "Ingen resultater fundet",
                "infoFiltered": "(Filtreret ud af ialt _MAX_ listninger)",
                "paginate": {
                "previous": "Forrige",
                "next": "Næste"
                 }
            },
            "aoColumnDefs": [
                  { "bSortable": false, "aTargets": [ -1 ] },
                  { "bSearchable": false, "aTargets": [ -1 ] }
            ],
            "sDom": 'T<"clear">lfrtip',
            "tableTools": {
                "sSwfPath": "(Of course the real path is different)../swf/copy_csv_xls_pdf.swf",
                "aButtons": [ 
                {
                    "sExtends":    "csv",
                    "oSelectorOpts": { filter: 'applied', order: 'current' }
                },
                {
                    "sExtends":    "xls",
                    "oSelectorOpts": { filter: 'applied', order: 'current' }
                },
                {
                    "sExtends":    "pdf",
                    "oSelectorOpts": { filter: 'applied', order: 'current' }
                }
              ]
            }  
    } );
    
This discussion has been closed.