Add new row after each row in fnRowCallback

Add new row after each row in fnRowCallback

hottigerhottiger Posts: 5Questions: 0Answers: 0
edited July 2012 in General
Hi,

I'm trying to achieve the following look using dataTables:

http://img717.imageshack.us/img717/6609/33521381.png

So the idea is you click the purple button and a row expands/collapses. I've already got the table populating minus the extra row that needs to appear.

The data is coming from a json source, my initial thinking was to try the following:

[code]
'fnRowCallback': function (nRow, aData) {
var $td = $('').html(aData[5]),
$tr = $('').append($td);
$(nRow).after($tr);
});
[/code]

However this doesn't work. Does anyone have any ideas how I might achieve this?

Thanks

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    DataTables has an API for this feature already - see this blog post on details of how to use fnOpen and fnClose : http://datatables.net/blog/Drill-down_rows

    Allan
  • hottigerhottiger Posts: 5Questions: 0Answers: 0
    Perfect thanks!
This discussion has been closed.