Fixed columns - auto horiz scroll to right on load

Fixed columns - auto horiz scroll to right on load

sr1sr1 Posts: 4Questions: 0Answers: 0
edited September 2011 in General
I have a table with 30+ columns, with fixed cols left and right,

At the moment when you load the table you see left part of the inner table, is it possible to automatically move this to the right so the later cols are visable first ?

Replies

  • allanallan Posts: 61,786Questions: 1Answers: 10,114 Site admin
    Hi sr1,

    While there isn't a built in initialisation parameter to do this, what you can do is simply set the 'scrollLeft' property of the DataTables scrolling element when the table has completed its initialisation. For example on this demo page ( http://datatables.net/release-datatables/extras/FixedColumns/left_right_columns.html ) you can run this following on the Javascript control to jump the scrolling position:

    [code]
    $('div.dataTables_scrollBody').scrollLeft(100);
    [/code]

    So in your DataTables initialisation code you could use fnInitComplete ( http://datatables.net/ref#fnInitComplete ) to run that code when the initialisation is done.

    Regards,
    Allan
This discussion has been closed.