I change the pagelength in datatable but not show the export buttons in datatable

I change the pagelength in datatable but not show the export buttons in datatable

itteambgsitteambgs Posts: 11Questions: 2Answers: 0

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

Answers

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    pls reply for my qn

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    Please link to a test case, as required in the forum rules and the template text that you didn't fill in.

    Allan

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    Hi All,
    I am using datatables version : **1.10.24 **

    I want to change default pagination to 500 / page for this I have included below script as

    $('#example1').dataTable( {
    "pageLength": 50
    });

    unfortunately export button like excel, pdf,print & copy are hidden or not showing.
    how to fix it. This is my first post if any thing wrong apologize it.

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    1.10.24 is three years old and no longer supported. I would suggest you update to the current release - 2.0.3.

    That said, I see nothing in your confirmation that would make the Buttons show. I would have expected the use of the dom parameter, or perhaps a use of the API to insert the buttons after initialisation.

    Without a test case it is impossible to say for sure what is wrong.

    Allan

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    Hi all,
    I had change the upgrade version for datatable . I get answer all data rows shows in one page.Thank you.
    But I need add the export buttons are excel,pdf,print and coloumn visibility .

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    Can any one pls reply for me?

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    You sometimes need to wait more than 9 minutes for a reply before bumping a post.

    You haven't provided a test case, as previously asked for, so I don't know why the export buttons wouldn't be showing for you.

    This example shows how to get the export buttons to display.

    If you are having problems with that, please provide a test case.

    Allan

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0
    edited April 15
    <script src="<?php echo base_url('resources/plugins/datatables-buttons/js/dataTables.min.js');?>"></script>
    <link rel="stylesheet" href="<?php echo base_url('resources/plugins/datatables-buttons/css/dataTables.dataTables.min.css');?>">
    

    i was use for upgrade version cdn .

    Then i used some script codes for show the export buttons .

    I will show the codes below:

    new DataTable('#example1', {
      pageLength:150,
        layout: {
            topStart: {
                buttons: [  'copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5','colvisHtml5']
    
                
            }
        }
    });
    
    <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
    <script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/dataTables.buttons.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.dataTables.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.html5.min.js"></script> 
    

    Edited by allan Syntax highlighting

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    I get the export buttons show and using the above code.

    but didnot show the colvisHtml5 and printHtml5
    what i code use for this

  • allanallan Posts: 61,821Questions: 1Answers: 10,127 Site admin

    You'd need

    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.print.min.js"></script> 
    

    for the print button.

    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.colVis.min.js"></script> 
    

    For the column visibility button.

    Use the download builder to make sure you get all the files you need.

    Allan

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0
    edited April 26

    css:

    <link rel="stylesheet" type="text/css" href="path/to/datatables.min.css">
    <link rel="stylesheet" href="<?php echo base_url('resources/plugins/datatables-buttons/css/dataTables.dataTables.min.css');?>">
    
    <script src="<?php echo base_url('resources/plugins/datatables-buttons/js/dataTables.min.js');?>"></script>
    <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
    <script src="https://cdn.datatables.net/2.0.3/js/dataTables.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/dataTables.buttons.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.dataTables.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.html5.min.js"></script> 
    and
    <link rel="stylesheet" type="text/css" href="path/to/datatables.min.css">
    <link rel="stylesheet" href="<?php echo base_url('resources/plugins/datatables-buttons/css/dataTables.dataTables.min.css');?>">
    
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.print.min.js"></script>
    <script src="https://cdn.datatables.net/buttons/3.0.1/js/buttons.colVis.min.js"></script>
    <script>
     new DataTable('#example1', {
      pageLength:150,
        layout: {
            topStart: {
                buttons: [  'copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5','colvisHtml5', 'printHtml5']
    
                
            }
        }
    });
    </script>
    

    i used above the scripts for all data rows show in one page with show the export buttons .
    But i am not till get the proper working function page.
    And i using the script code blelow i give:

    <script>
     new DataTable('#example1', {
      pageLength:150,
        layout: {
            topStart: {
                buttons: [  'copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5','colvisHtml5', 'printHtml5']
    
                
            }
        }
    });
    </script>
    

    And i got the DataTables warning: table id=example1 - Cannot reinitialise DataTable. For more information about this error, please see https://datatables.net/tn/3 in this error in my page.
    And shot showing th e colvis ,print buttons

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

  • kthorngrenkthorngren Posts: 20,364Questions: 26Answers: 4,777
    edited April 26

    I don't believe there are colvisHtml5 and printHtml5 button types. See the Built-in buttons doc for more details. Try this instead:

    buttons: [  'copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5','colvis', 'print']
    

    Use the troubleshooting steps at the link in the error:
    https://datatables.net/tn/3

    If you need help with this then please post a link to your page or test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • itteambgsitteambgs Posts: 11Questions: 2Answers: 0

    DataTables warning: table id=example1 - Cannot reinitialise DataTable. For more information about this error, please see https://datatables.net/tn/3
    how to i solve above problem in datatable

  • colincolin Posts: 15,158Questions: 1Answers: 2,587

    It sounds like you're initialising the table multiple times - that's the only reason why you'd get that error. You can call destroy() before re-initialising.

    But as Kevin said, please provide a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Colin

Sign In or Register to comment.