Limit to x number of entries when exported with DATATABLES.JS

1

That, someone knows how I can limit the number of data to export when I use the tableTools library, let's say that if I use 100 entries I only copy or export those 100 entries, since when I copy or export I usually copy more than 500 records from my db. this is how I add that dataTable function

$('.dataTable').dataTable({
      "bJQueryUI": 'true',
      "dom": 'T<"clear">lfrtip',
      "sPaginationType": "full_numbers",
      "tableTools": {
      "sSwfPath": "./swf/copy_csv_xls_pdf.swf"}
   });
    
asked by matteo 15.06.2016 в 16:43
source

1 answer

1

The question is not very clear to me, but I assume that those 100 records are those that are visible in the current page. Then oSelectorOpts can be your solution:

<script>
$(document).ready(function() {
var table = $('#example').DataTable( {
    "bJQueryUI": 'true',
    "pagingType": "full_numbers",
    "iDisplayLength": 10,
    "dom": 'T<"clear">lfrtip',
    "oTableTools": {
      "aButtons": [
        {'sExtends':'copy',
          "oSelectorOpts": { filter: 'applied', order: 'current' },
        },
        {'sExtends':'xls',
          "oSelectorOpts": { filter: 'applied', order: 'current' },
        },
        {'sExtends':'print',
          "oSelectorOpts": { filter: 'applied', order: 'current' },
        }
      ]
    },
});
});

    
answered by 16.06.2016 / 12:37
source