DataTable Nesting
DataTable Nesting
Hi Alan
I am using slightly modified version of http://datatables.net/examples/server_side/row_details.html
Instead of getting the data from the table I am making a call to server to get more details about the row on click... I get back json which I need to display using another dataTable
This function receives json instead of nTr
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var iIndex = oTable.fnGetPosition( nTr );
var aData = oTable.fnSettings().aoData[iIndex]._aData;
var sOut = '';
sOut += 'Rendering engine:'+aData[2]+' '+aData[5]+'';
sOut += 'Link to source:Could provide a link here';
sOut += 'Extra info:And any further details here (images etc)';
sOut += '';
return sOut;
}
I am wondering, if I can use another DataTable inside this function body to paint the row as I want... ??
The JSON i am receiving for this row is pretty huge and I was thinking if there is any alternative way instead of writting huge HTML....??
Thanks in Advance
I am using slightly modified version of http://datatables.net/examples/server_side/row_details.html
Instead of getting the data from the table I am making a call to server to get more details about the row on click... I get back json which I need to display using another dataTable
This function receives json instead of nTr
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var iIndex = oTable.fnGetPosition( nTr );
var aData = oTable.fnSettings().aoData[iIndex]._aData;
var sOut = '';
sOut += 'Rendering engine:'+aData[2]+' '+aData[5]+'';
sOut += 'Link to source:Could provide a link here';
sOut += 'Extra info:And any further details here (images etc)';
sOut += '';
return sOut;
}
I am wondering, if I can use another DataTable inside this function body to paint the row as I want... ??
The JSON i am receiving for this row is pretty huge and I was thinking if there is any alternative way instead of writting huge HTML....??
Thanks in Advance
This discussion has been closed.
Replies
Yes, you should be able to nest one DataTable inside another. There are a couple of known issues in 1.5.2 with the element selectors that I have used not being quite right with nested tables, but this will be addressed in 1.5.3 (hopefully out in the next few days...). In the mean time, it might be worth just trying it and seeing how it goes for you.
Regards,
Allan