Question

I'm trying to use this dataTable javascript library in my Rails 4 project. I'm using this rails gem to install the javascript library for convenience.

The problem is that no initialisation options are working. For example:

$('.datatable').dataTable({
    pageLength: 50
});

This should let there be 50 visible records as default at initialisation, however 10 is still the default. No other options are working ether.

Any hint, or help is appreciated! :)

Was it helpful?

Solution

The option you're looking for is iDisplayLength.

From the documentation:

iDisplayLength - Number of rows to display on a single page when using pagination.

Code:

$('.datatable').dataTable({
    "iDisplayLength": 50
});

DEMO

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