How to fix dataTables pagination at a minimum height from top ?

How to fix dataTables pagination at a minimum height from top ?

PrateekParekhPrateekParekh Posts: 13Questions: 3Answers: 0
edited November 2015 in Free community support

Consider a Datatable:

var x = $('#tab').dataTable({
        "aaData": sourc,
        "sPaginationType": "full_numbers",
        "bFilter": true,
        "bProcessing": true,
        "bRedraw": true,
        "bDestroy": true,
        "bInfo": false,
        "bLengthChange": true,
        "lengthMenu": [[1,10, 20, 30, 40, 50], [1,10, 20, 30, 40, 50]],
        "aoColumns": [
        {"mData": "Title1"},
        {"mData": "Title2"},
        {"mData": "Language"}
        ]
});

Now if the length of my table is 10 ROWS the pagination is at bottom and keeps going down as I increase the size.
What can be done so that if the height is less than 10 ROWS the pagination still remains at the constant height/distance of 10 ROWS from top regardless of number of rows and keeps going down if I increase - but effectively, giving the table a MIN height.Scroll is not needed.

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin
    Answer ✓

    There is currently no option for that. You could create write a drawCallback function that would simply insert empty rows into the table that would force it to have 10 records (i.e. just add empty records until it has 10, if it has less than ten).

    That could be wrapped up into a plug-in if you wanted. I'm sure others would be interested in using the code you develop if you can share it.

    Allan

  • PrateekParekhPrateekParekh Posts: 13Questions: 3Answers: 0

    Is there a way to move pagination(#tab_paginate) out of dataTables wrapper(#tab_wrapper) where we can fix it's position regardless of number of entries?

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin
    Answer ✓

    Sure - use jQuery. $('#tab_paginate').appendTo( ... );.

    Allan

This discussion has been closed.