dom: 'Bfrtip' ?

dom: 'Bfrtip' ?

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

I'm using this : https://datatables.net/extensions/buttons/examples/initialisation/export.html

But when I add dom: 'Bfrtip' then my table completely gets screwed with

Showing 1 to 2 of 2 entries (filtered from 57 total entries) 
1 2 3 4 .. etc

Being showed at the farthest right of the table, NEXT to my table... Any idea why?

This question has an accepted answers - jump to answer

Answers

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    My code :

    $(document).ready(function() {
            var oTable = $('#achats_table').DataTable( {
                aLengthMenu: [
                    [100, 200, 500, 1000,  -1],
                    [100, 200, 500, 1000, "Tous"]
                ],
                language: {
                    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"
                },
                columnDefs: [
                    {
                        "className": "text-right", 
                        "targets": "_all"
                    }
                ],
                buttons: [
                    'csv', 'excel', 'pdf', 'print'
                ],
                "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
                    var api = this.api();
    
                    countRows = api.rows().count();
        
                    // Remove the formatting to get integer data for summation
                    var intVal = function ( i ) {
                        return typeof i === 'string' ?
                            i.replace(/[\$, \u20AC%]/g, '')*1 :
                            typeof i === 'number' ?
                                i : 0;
                    };
    
                    if(quantiteExists) {
                        A= api
                            .cells( null, 0, { search: 'applied' }  )
                            .render('sort')
                            .reduce( function (a, b) {
                                return intVal(a) + intVal(b);
                            }, 0 );
                    } 
                    // Update footer
                    if(quantiteExists) {
                        $( api.column( 0 ).footer() ).html(number_format(A, 0, '.', ' ') + ' ');
                    } 
                }
            } );
            new $.fn.dataTable.FixedHeader( oTable, {
                alwaysCloneTop: true
            });
        } );
    
  • colincolin Posts: 15,240Questions: 1Answers: 2,599
    Answer ✓

    Hi @islamelshobokshy ,

    Have you include the Buttons JS and CSS files? They're all listed on that page you linked to.

    Cheers,

    Colin

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    Which ones specifically?

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    All of the ones listed on the bottom of that page! :) You'll see the JS ones on the Javascript tab, and the CSS ones under the CSS tab.

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    When I do that, the row entries dissapears

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    That suggests a Javascript error - if you link to the page we'd be happy to take a look.

    Alternatively, use the download builder to construct a package with all the files you need.

    Allan

This discussion has been closed.