drilldown rows
drilldown rows
hi,
I'm trying to convert php table to a datatable with drill down rows. I don't know how to include the second table/details. The code I've got is:
[code]
$(document).ready(function() {
var anOpen = [];
var sImageUrl = "/DataTables/examples/examples_support/";
var oTable = $('#example').dataTable( {
"bPaginate": true,
"bJQueryUI": true,
"aoColumns": [
{
"mDataProp": null,
"sClass": "control center",
"sDefaultContent": ''
},
{ "mDataProp": "edit" },
{ "mDataProp": "delete" },
{ "mDataProp": "project" },
{ "mDataProp": "ops" },
{ "mDataProp": "jops" }
]
} );
$('#example td.control').live( 'click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
if ( i === -1 ) {
$('img', this).attr( 'src', sImageUrl+"details_close.png" );
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
anOpen.push( nTr );
oTable2=$('#the_table2').dataTable();
}
else {
$('img', this).attr( 'src', sImageUrl+"details_open.png" );
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
oTable.fnClose( nTr );
anOpen.splice( i, 1 );
} );
}
} );
} );
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+ ??????
'Team NameTeam Leader'+ ?????
''+null+''+null+''+ ????????
''+
'';
return sOut;
}
for($p=0; $p<$i; $p++)
{
echo "";
echo "";
echo "".$nazwa_p[$p]."";
echo "".$ops[$p]."";
echo "".$jops[$p]."";
echo "";
echo "";
echo "";
echo "";
problem strting here
???? echo "";
echo "";
echo "Team Name";
echo "Team Leader";
echo "";
if ($teamcounter[$p] == 0)
{
echo "";
echo "-";
echo "-";
echo "";
}
else
{
for ($t=0; $t<$teamcounter[$p]; $t++)
{
echo "";
echo "".$tablicat[$p][$t][0]."";
echo "".$tablicat[$p][$t][1]."";
echo "";
}
}
echo "
???
echo "";
}
mysql_close($con); ?>
[/code]
Can it be done without any ajax?
[/code]
I'm trying to convert php table to a datatable with drill down rows. I don't know how to include the second table/details. The code I've got is:
[code]
$(document).ready(function() {
var anOpen = [];
var sImageUrl = "/DataTables/examples/examples_support/";
var oTable = $('#example').dataTable( {
"bPaginate": true,
"bJQueryUI": true,
"aoColumns": [
{
"mDataProp": null,
"sClass": "control center",
"sDefaultContent": ''
},
{ "mDataProp": "edit" },
{ "mDataProp": "delete" },
{ "mDataProp": "project" },
{ "mDataProp": "ops" },
{ "mDataProp": "jops" }
]
} );
$('#example td.control').live( 'click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );
if ( i === -1 ) {
$('img', this).attr( 'src', sImageUrl+"details_close.png" );
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
$('div.innerDetails', nDetailsRow).slideDown();
anOpen.push( nTr );
oTable2=$('#the_table2').dataTable();
}
else {
$('img', this).attr( 'src', sImageUrl+"details_open.png" );
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
oTable.fnClose( nTr );
anOpen.splice( i, 1 );
} );
}
} );
} );
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+ ??????
'Team NameTeam Leader'+ ?????
''+null+''+null+''+ ????????
''+
'';
return sOut;
}
for($p=0; $p<$i; $p++)
{
echo "";
echo "";
echo "".$nazwa_p[$p]."";
echo "".$ops[$p]."";
echo "".$jops[$p]."";
echo "";
echo "";
echo "";
echo "";
problem strting here
???? echo "";
echo "";
echo "Team Name";
echo "Team Leader";
echo "";
if ($teamcounter[$p] == 0)
{
echo "";
echo "-";
echo "-";
echo "";
}
else
{
for ($t=0; $t<$teamcounter[$p]; $t++)
{
echo "";
echo "".$tablicat[$p][$t][0]."";
echo "".$tablicat[$p][$t][1]."";
echo "";
}
}
echo "
???
echo "";
}
mysql_close($con); ?>
[/code]
Can it be done without any ajax?
[/code]
This discussion has been closed.