Change List length to Button length in custom first row

Change List length to Button length in custom first row

John DowJohn Dow Posts: 16Questions: 6Answers: 0

I have a custom first row template (three parts), thanks Kevin. Using this I get that the button is above the row. How to put a new button in

dom: "<'row'<'col-sm-12 col-md-3'**HERE**><'col-sm-12 col-md-6'f><'col-sm-12 col-md-3'B>>"

It is my code:

var table = new DataTable('#example', {
  dom: "<'row'<'col-sm-12 col-md-3'l><'col-sm-12 col-md-6'f><'col-sm-12 col-md-3'B>>" +
        "<'row'<'col-sm-12'tr>>" +
        "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
    buttons: [
        'copy', 'excel'
    ]
  
  
} );

new $.fn.dataTable.Buttons( table, {
        buttons: [
          'pageLength'
        ]
    } );
 
    table.buttons( 1, null).container().prependTo(
        table.table().container()
    );

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,938Questions: 26Answers: 4,875
    Answer ✓

    Take a look at the dom Markup docs to see how to add an ID to one of the div elements. Add the ID and change line 19 to use that ID as the selector. For example:

    dom: "<'row'<'#page-length.col-sm-12 col-md-3'>
    
    table.buttons( 1, null).container().prependTo(
      '#page-length'
    );
    

    https://live.datatables.net/hawubena/4/edit

    Kevin

  • John DowJohn Dow Posts: 16Questions: 6Answers: 0

    Thank you Kevin, I learned a lot from you! It is work!

Sign In or Register to comment.