Server-side Row Details; repositioning the click column

Server-side Row Details; repositioning the click column

CatCat Posts: 18Questions: 8Answers: 0
edited August 2014 in Free community support

I'm currently initialising this example: http://datatables.net/examples/server_side/row_details.html

By default, the example places an extra column at the beginning of the table which has a button for each row which upon clicking expands additional information about the record. Question is, how to put that column somewhere else than at the very beginning of the table? I want it to be the 7th column, near the middle of my table.

Additionally, but optionally, is it also possible to give that column a head/title like all the other columns have? (like "First Name", "Last Name", "Position" and "Office", meanwhile the first column by default has nothing)

Any help will be greatly appreciated, thanks in advance :)

EDIT: the optional issue has been resolved, for anyone else wondering the same thing; there is an empty <th></th> in the table html, place any desired title in there.

Answers

  • CatCat Posts: 18Questions: 8Answers: 0
    edited August 2014

    Changing the order in "columns" in the initialisation javascript seems to move it, but it stops working afterwards... it no longer opens the child row when clicking on the button

    EDIT: Actually, it moves the button, but the child row still appears when you click on the first column :S

    It may have something to do with the "td:first-child" part towards the end of the initialisation javascript, but it doesn't look like you can simply change it to "td:seventh-child" or something... :P

  • CatCat Posts: 18Questions: 8Answers: 0

    I haxed up my own solution to the problem; I changed td:first-child to a useless html tag and made a database column with that tag in its entries, now whenever that tag is clicked the child row appears and the tag needs only be added where desired. It works, but it's not pretty and it's not resource-friendly, but it works.

    The problem is now solved for my case, but it doesn't quite answer the initial question, so if there's any other solution it may come in handy for others

This discussion has been closed.