Second DataTables into Drill Down Row
Second DataTables into Drill Down Row
Hi, i'm italian, sorry for my english...
I Can get a Indipendent Datatables into Drill Down Row?
I try to get this code but not work
[code]
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
'$(document).ready(function() {'+
'$(\'#the_table2\').dataTable();'+
'} );'+
''+
'';
alert(sOut);
return sOut;
}
[/code]
The alert show "$(document).ready(function() {$('#the_table2').dataTable();} );"
I think that right, but not work...anyone could help me?
I Can get a Indipendent Datatables into Drill Down Row?
I try to get this code but not work
[code]
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
'$(document).ready(function() {'+
'$(\'#the_table2\').dataTable();'+
'} );'+
''+
'';
alert(sOut);
return sOut;
}
[/code]
The alert show "$(document).ready(function() {$('#the_table2').dataTable();} );"
I think that right, but not work...anyone could help me?
This discussion has been closed.
Replies
Allan
this the function fnFormatDetails:
[code]
function fnFormatDetails( oTable, nTr )
{
var oData = oTable.fnGetData( nTr );
var sOut =
''+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
' Movimento'+
' '+
''+
''+
''+
'Loading data from server'+
''+
''+
''+
''+
' ID Movimento'+
' ID Magazzino '+
' Data'+
' Autore'+
' Movimento'+
' '+
''+
''+
'';
return sOut;
}
[/code]
e this is the function that calls it
[code]
$('#the_table 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 );
}
else {
$('img', this).attr( 'src', sImageUrl+"details_open.png" );
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () {
oTable.fnClose( nTr );
anOpen.splice( i, 1 );
} );
}
} );
[/code]
should i initialize the new Datatables here and then pass it here?
( nTr, fnFormatDetails(NewoTableinitialize, nTr), 'details' );
[code]
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();
............
[/code]
i pass however oTable to the function fnFormatDetails to get the ID of the row... i need it for the query sql...thanks allan!
this datatables is great!!
[code]
var oData = oTable.fnGetData( nTr );
var oTable2 = $('#example2').dataTable({
"bPaginate": false,
"bLengthChange": false,
....
"sAjaxSource" : "@{AController.action(oData.propertyOne)}"
[/code]
But the oData is null in the initialization, I got an error:
[quote]
Cannot get property 'propertyOne' on null object.
[/quote]
How can I pass a variable into the sAjaxSource variable for datatable initialization?
Thank you a lot.
[code]
"fnServerData": function ( sAjaxSource, aoData, fnCallback ) {
aoData.push( { "name": "name", "value": oData.name } );
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sAjaxSource,
"data": aoData,
"success": fnCallback
} );
}
[/code]
Still nothing happened. I guess 'oData' is not available when initializing sAjaxSource, that's why I got an null object error. I was able to pass an constant value to sAjaxSource and got result, but no luck with oData.
Would somebody help on this? Any idea is much appreciated.
Allan
However, if I expand the row details bottom-up, all rows have their nested detail table initialized. Why? Thanks in advance!