Print view should not cause iDisplayLength = -1 when bServerSide = True

Print view should not cause iDisplayLength = -1 when bServerSide = True

davidhoratdavidhorat Posts: 2Questions: 0Answers: 0
edited June 2010 in TableTools
Dear community,

Testing TableTools I found little gotcha: When you print, DataTools will always try to set iDisplayStart to 0 and iDisplayLength to -1. Unfortunately, when you are using server side processing in DataTables, it is common to have thousands of rows which you don't want to present altogether. More over, you want the user to control which part of the table they want to see.

I suggest changing DataTables behaviour so it will check for bServerSide and only set iDisplayStart and iDisplayLength if that variable is False.

That means changing:
[code]
_DTSettings._iDisplayStart = 0;
_DTSettings._iDisplayLength = -1;
[/code]

For
[code]
if (! _DTSettings.oFeatures.bServerSide) {
_DTSettings._iDisplayStart = 0;
_DTSettings._iDisplayLength = -1;
}
[/code]

Any comments?

I would love to see this change in the next release of TableTools so I don't need to have self-made. I consider it a stable piece of software.

Best Regards,
David Horat

Replies

  • sharecodesharecode Posts: 2Questions: 0Answers: 0
    Hi David,
    almost two years, but still worth comments :)

    It can be done by setting "bShowAll" to false, this way

    [code]
    $(document).ready( function () {
    $('#example').dataTable( {
    "sDom": 'T<"clear">lfrtip',
    "oTableTools": {
    "aButtons": [
    {
    "sExtends": "print",
    "bShowAll": false
    }
    ]
    }
    } );
    } );
    [/code]

    Cheers.
This discussion has been closed.