How do I fetch sql data inside row details.
How do I fetch sql data inside row details.
pixelwolfie
Posts: 2Questions: 0Answers: 0
Hi all, I currently have one single table that fetches from an sql database. However, I do not want all of the data to be seen at first glance, hence I used the row details function. So upon clicking the plus button, there would be a table showing the remaining data which is also taken from the same sql database for the particular row.
[code]
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Item IdItem DescriptionQuantityPrice';
sOut += '';
return sOut;
}
[/code]
The code above is a table I've inserted for the row details, but I'm not sure how to retrieve rows from the sql database based on the original table rows.
This is a pic of how it looks like:
http://i1303.photobucket.com/albums/ag150/pixelwolfie/rowdetails.png
Thanks,
Pixelwolfie
[code]
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Item IdItem DescriptionQuantityPrice';
sOut += '';
return sOut;
}
[/code]
The code above is a table I've inserted for the row details, but I'm not sure how to retrieve rows from the sql database based on the original table rows.
This is a pic of how it looks like:
http://i1303.photobucket.com/albums/ag150/pixelwolfie/rowdetails.png
Thanks,
Pixelwolfie
This discussion has been closed.
Replies
Check http://www.datatables.net/blog/Drill-down_rows
[code]
$('#example td.control').live( 'click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
var aData = oTable.fnGetData( nTr );
var rowId = aData[0];
// other code
});
[/code]