Help with double argument

Help with double argument

satyriasissatyriasis Posts: 30Questions: 7Answers: 0
edited October 2021 in Free community support

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

<

script>

   $(document).ready(function() {
    $('#moja').DataTable({
        language: {
           url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/hr.json'
         }
  });
} );
</script>

I have put this argument but am interested in adding CSV download button beneath the form. This was suggested to me:

<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.1/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.flash.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.html5.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.1/js/buttons.print.min.js"></script>
<script type="text/javascript">
   jQuery(document).ready(function() {
       jQuery('#myTable').DataTable( {
           dom: 'Bfrtip',
           buttons: [
               { extend: 'copy', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
               { extend: 'csv', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
               { extend: 'excel', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
               { extend: 'pdf', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
               { extend: 'print', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' }
           ]
       } );
   } );
</script>

I am interested in how to connect those 2 arguments together so that I have translation and those buttons too?

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951
    Answer ✓

    The options need to be separated by commas. Just combine them all in one Datatatables init code, like this:

        $('#moja').DataTable({
              language: {
                 url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/hr.json'
               },
               dom: 'Bfrtip',
               buttons: [
                   { extend: 'copy', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
                   { extend: 'csv', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
                   { extend: 'excel', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
                   { extend: 'pdf', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' },
                   { extend: 'print', className: 'nectar-button medium regular extra-color-1  regular-button tableBtn' }
               ] });
    

    Kevin

Sign In or Register to comment.