row details to expand upwards instead of downwards
row details to expand upwards instead of downwards

Hi Allan,
is there a way to expand the rows upwards instead of downwards? row details should come above the actual row, instead of below.
can I get any examples of that kind.
This discussion has been closed.
Answers
You can use Jquery to move the child with the insertBefore function.
In the code that opens the child,(in the example it looks like this)
you need to add this bit at the end..
Thanks Thom.This works when a click event happens, but incase of table redrawn like paging, filter, sorting when the rows are expanded. it redraws showing the child below the parent Tr. I expand few rows and do filter. Table is redrawn and automatically the childs are below the parent tr.
Well, I thought I could tap into the dt draw or search events and use the same idea:
but no luck.
The event fires but at that moment the child row isn't yet part of the DOM, so the attempt to get the "next" tr brings up the next main row in the table.
Hopefully Allan can suggest what event we need to latch on to.
The
draw
event is the correct one - you just need to do it when the row is displayed as well since that doesn't trigger a draw. Example: http://live.datatables.net/sinigatu/1/editI used the following to insert the child row before the parent:
You could pass the
table
variable in if you wanted to be able to reuse it for other tables (i.e. select only the rows in the given table).Allan
Hi Allan,
Thanks for responding. Even in the above link which you have shared, when I expand a single after a click event it adds child row on top of parent. But when I do a search filter after expanding, table is redrawn and child moves below the parent. It doesnt remain on top of parent. And even when the search filtered is removed, its redrawn adding child on to top of parent.
Try this one: http://live.datatables.net/sinigatu/8/edit .
Allan
Thanks Allan. i could see that these lines are added. Could please explain how is that happening on filter,sort and paging.
setTimeout( function () {
moveInserts();
}, 10 );
i think i got it. is it like child rows are loaded into the DOM and then 10s later we are calling the function. if we dont delay it for 10s, since child rows are not present in DOM, next 'tr' is other parent row. please confirm if correct.
10mS, but yes that is the issue. Its just code ordering - the child rows were being added after the event handler was being called.
Allan
Thanks for the reply and help provided.