Fixing one row to top of DataTable which will be displayed in all pages

Fixing one row to top of DataTable which will be displayed in all pages

macusermacuser Posts: 20Questions: 0Answers: 0
edited June 2013 in General
Hi All,

Is it possible to have one row which will be fixed to the top of the body content, immediately after the table header.
This must be retained even when user navigates to a different page, scrolls through the data and sorts them.

Is this possible in DataTable 1.8.

Thanks,
Swad

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    What you could do is use fnDrawCallback to attach the row you want to the top of the table (prepend in jQuery) on every draw. Then it will be there at the top of the table all the time.

    Allan
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Another option, thinking about it, is just to have a second header row - that would be easier!

    Allan
  • macusermacuser Posts: 20Questions: 0Answers: 0
    Allan, thank you for your reply.

    I'm planning to have an expand row on the first fixed row, similar to fnOpen. In the second option, if I have it in the header, I guess it would break the layout.

    In first approach, I will not be able to make the row fixed (sticking to the header irrespective of scroll) and only the other rows scrollable.

    Is there any workaround for this or should I sacrifice the scroll requirement.

    Thanks,
    Swad
This discussion has been closed.