DataTables with hidden row show php data

DataTables with hidden row show php data

amarkotha366amarkotha366 Posts: 1Questions: 0Answers: 0
edited April 2014 in DataTables
I am using DataTables with a hidden details row.

It is working well general data table with static data in hidden row.I want to show my php data in hidden row.

I am using this javascrupt code with static hidden row data

[code]
function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
sOut += 'Rendering engine:'+aData[1]+' '+aData[4]+'';
sOut += 'Link to source:$link Could provide YOUR link here';
sOut += 'Extra info:And any further details here (images etc)';
sOut += '';

return sOut;
}

$(document).ready(function() {

$('#dynamic-table').dataTable( {
"aaSorting": [[ 4, "desc" ]]
} );


var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = '';
nCloneTd.className = "center";

$('#hidden-table-info thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );

$('#hidden-table-info tbody tr').each( function () {
this.insertBefore( nCloneTd.cloneNode( true ), this.childNodes[0] );
} );


var oTable = $('#hidden-table-info').dataTable( {
"aoColumnDefs": [
{ "bSortable": false, "aTargets": [ 0 ] }
],
"aaSorting": [[1, 'asc']]
});


$(document).on('click','#hidden-table-info tbody td img',function () {
var nTr = $(this).parents('tr')[0];
if ( oTable.fnIsOpen(nTr) )
{

this.src = "images/details_open.png";
oTable.fnClose( nTr );
}
else
{

this.src = "images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
}
} );
} );

[/code]
Here is the HTML code the table with php:
[code]









Name
Phone number
E-mail
subscribed
App language
joined
banned
Action



<?php
for($i = 0; $i < count($cd); $i++)
{
print'';
print''.$cd[$i][1].'';
print''.$cd[$i][2].'';
print''.$cd[$i][3].'';


if($cd[$i][6]=="0")
{
print'Not Subscribed';
}
else if($cd[$i][6]=="1")
{
print'Subscribed';

}





print''.$cd[$i][4].'';
print' '.$cd[$i][5].'';


if($cd[$i][7]=="0")
{
print'Not Banded';
}
else if($cd[$i][7]=="1")
{
print'Banded';

}


print'


Actions

Toggle Dropdown



Edit
Remove';
if($cd[$i][7]=="0")
{
print'Band This Account';
}
else
{
print'Active This Account';
}

if($cd[$i][6]=="0")
{
print'Active Subscription';
}
else
{
print'UnSubscribe';
}


print'

';


print'';

}

?>










[/code]
here my data come in [code] $cd = $c->Select_all();[code] and using for loop i show my data.

now how can i show my for loop data in hidden row .
This discussion has been closed.