Question

I have this:

oTable = $("#bla").dataTable({ 
    "iDisplayLength": 50, 
    "aLengthMenu": [[5, 25, 50, 100, 250, -1], [5, 25, 50, 100, 250, "All"]], 
    "sDom": "<'call-header'<'dthead'><'ttools'T><'filterinput'f>r><'dttoolbar'><'dataTables_scroll'<'dataTables_scrollBody't>><'call-footer'<'row-fluid'<'span6'i><'span6'p>>>",

.... });

If I comment out the sDom part, I get my length menu and I am able to select the number of items to show on the page. But with the SDOM variable, this just disappears.

I've tried combinations of adding:

<'dataTables_length'>

But I think I am misunderstanding how it works. Can anyone clarify how this must be done?

Was it helpful?

Solution

See the documentation for sDom - the sDom code for Length changing is l.

Here the length menu is being inserted as the very first control :

sDom: "<'call-header'<'dthead'>l<'ttools'T><'filterinput'f>r><'dttoolbar'><'dataTables_scroll'<'dataTables_scrollBody't>><'call-footer'<'row-fluid'<'span6'i><'span6'p>>>"
                            ---^---

fiddle -> http://jsfiddle.net/eCrhb/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top