Display 'details' row above instead of below row.

Display 'details' row above instead of below row.

blfravelblfravel Posts: 2Questions: 0Answers: 0
edited February 2014 in General
So I am trying to add a details row for every row in the table, and it is working fine. However, I would like the details row to be displayed above each row, instead of below each row. The purpose for this is that the details will contains a title and a link regarding the row. I am successfully opening every row, I just need the details to be displayed above instead of below.

I know that I can edit the dataTables.js _fnDraw( oSettings ) function to do this by swapping which row is drawn first; however, I have other tables where the details row needs to be drawn normally, and I do not want to edit this file.

Is there a way to do this?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I think you'd probably need to add an option into DataTables to have it insert the rows before or after. Alternatively you might be able to use fnDrawCallback to move the rows once they are in place, but it might be a bit fiddly.

    Allan
  • blfravelblfravel Posts: 2Questions: 0Answers: 0
    Thanks for the reply, I was able to use fnDrawCallback to swap the rows after every draw. Thanks again!
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I don't think I've come across this particular requirement for the child rows before, but I do quite like the flexibility that it offers. I've added it to my list of features to consider - thanks for the feedback.

    Allan
This discussion has been closed.