Button Placement in DataTable 2

Button Placement in DataTable 2

NoBullManNoBullMan Posts: 96Questions: 28Answers: 2

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
How do I place export to Excel and export to CSV buttons on top of the table between page length (topLeft) and search (topRight), same row?
I tried topCenter but it seems to take the whole row and pushes page length and search to next row.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 64,920Questions: 1Answers: 10,752 Site admin

    There isn't a topCenter (because then we might end up with topStartCenterCenter or something mad!). Instead you can use an array:

    layout: {
      top: [ 'pageLength', 'buttons', 'search' ],
      topStart: null,
      topEnd: null
    }
    

    Allan

  • NoBullManNoBullMan Posts: 96Questions: 28Answers: 2

    Thank you Allan.
    Is it possible to add some blurb above data table and below pagelength/buttons/search? Something like "Click on the label to view details".

  • allanallan Posts: 64,920Questions: 1Answers: 10,752 Site admin
    edited 4:24PM Answer ✓

    Sure. Two options:

    1) Use div:

    layout: {
      top: {
        div: {
          text: 'Click on the label to view details'
        }
      },
      top2: [ 'pageLength', ... ],
      ...
    }
    

    2) Use caption.

    Allan

  • NoBullManNoBullMan Posts: 96Questions: 28Answers: 2

    Perfect. Thank you very much.
    I love the layout option.

Sign In or Register to comment.