datatable length menu and buttons code example

Example 1: datatable lengthmenu

lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],

Example 2: export button removing length menu option datatable

Here is what I used to add the buttons to the datatable for the export etc:
http://datatables.net/reference/button/#tabletools

Note the dom: 'Bfrtip', property does not have the letter 'L' in it.

Referring to this you will note that adding 'L' to the dom property adds the 
length selector:
http://datatables.net/reference/option/dom

So the final dom should look like this:

dom: 'Blfrtip',
(note the additional 'L' after the 'B' character)

And length Menu Options:
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],

This will give you the export buttons and you can also select the row count to 
show. 

Hope this helps

Tags:

Misc Example