ehm ... psjandhyala I try it but nothing happened !!
Here changed code :
[code]
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = Table_list_project.fnGetData( nTr );
$.ajax({
type:"POST",
url: 'includes/__ajax_gear/_get_details_progetti.php',
cache: false,
data:'',
//data:"JS={\"jspro_id\":\""+new_id+"\",\"jspro_desc\":\""+new_desc+"\",\"jsun_id\":\""+unique_id+"\"}",
success: function(msg)
{
sOut = msg;
//your advice add this line here
Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
});
}
/* Event handler function */
function fnOpenClose ( oSettings )
{
$('td img', Table_list_project.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_open') )
{
// This row is already open - close it
this.src = "images/icons/details_close.png";
// fnClose doesn't do anything for server-side processing - do it ourselves :-)
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
// Open this row
this.src = "images/icons/details_open.png";
//your advice (comment line)--->Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
In the AJAX success call back method please pass your response text as follow.
correct way of code is
[code]
success: function(msg){
sOut = msg;
//we have to pass our response text as follow, Here I am passing sOut variable
//we should not pass fnFormatDetails(nTr)
Table_list_project.fnOpen( nTr, sOut , 'details' );
}
[/code]
/* Event handler function */
function fnOpenClose ( oSettings )
{
$('td img', Table_list_project.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_open') )
{
// This row is already open - close it
this.src = "images/icons/details_close.png";
// fnClose doesn't do anything for server-side processing - do it ourselves :-)
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
// Open this row
this.src = "images/icons/details_open.png";
//Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
Replies
[code]
function fnFormatDetails ( nTr )
{
var sOut;
var aData = Table_list_project.fnGetData( nTr );
$.ajax({
type:"POST",
url: 'includes/__ajax_gear/_get_details_progetti.php',
cache: false,
data:'',
success: function(msg)
{
sOut = msg;
}
});
return sOut;
}
[/code]
i just implemented in this concept in my project. Please do the following steps.
In the success call back method, please add following line
[code]oTable.fnOpen( nTr, sOut, 'details' );[/code]
and inside "Add event listener for opening and closing details"
[code]//oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );[/code]
Regards
psjandhyala
Paky
Here changed code :
[code]
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = Table_list_project.fnGetData( nTr );
$.ajax({
type:"POST",
url: 'includes/__ajax_gear/_get_details_progetti.php',
cache: false,
data:'',
//data:"JS={\"jspro_id\":\""+new_id+"\",\"jspro_desc\":\""+new_desc+"\",\"jsun_id\":\""+unique_id+"\"}",
success: function(msg)
{
sOut = msg;
//your advice add this line here
Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
});
}
/* Event handler function */
function fnOpenClose ( oSettings )
{
$('td img', Table_list_project.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_open') )
{
// This row is already open - close it
this.src = "images/icons/details_close.png";
// fnClose doesn't do anything for server-side processing - do it ourselves :-)
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
// Open this row
this.src = "images/icons/details_open.png";
//your advice (comment line)--->Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
[/code]
thanks
In the AJAX success call back method please pass your response text as follow.
correct way of code is
[code]
success: function(msg){
sOut = msg;
//we have to pass our response text as follow, Here I am passing sOut variable
//we should not pass fnFormatDetails(nTr)
Table_list_project.fnOpen( nTr, sOut , 'details' );
}
[/code]
This will solve your problem.
Regards
Psjandhyala
[code]
Table_list_project.fnOpen( nTr, sOut , 'details' );
[/code]
on first click event nothing happens .... on second click this error
Firebug Error:
> nRemove is undefined
thanks
[code]
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = Table_list_project.fnGetData( nTr );
$.ajax({
type:"POST",
url: 'includes/__ajax_gear/_get_details_progetti.php',
cache: false,
data:'',
//data:"JS={\"jspro_id\":\""+new_id+"\",\"jspro_desc\":\""+new_desc+"\",\"jsun_id\":\""+unique_id+"\"}",
success: function(msg)
{
sOut = msg;
Table_list_project.fnOpen( nTr, sOut, 'details' );
}
});
}
/* Event handler function */
function fnOpenClose ( oSettings )
{
$('td img', Table_list_project.fnGetNodes() ).each( function () {
$(this).click( function () {
var nTr = this.parentNode.parentNode;
if ( this.src.match('details_open') )
{
// This row is already open - close it
this.src = "images/icons/details_close.png";
// fnClose doesn't do anything for server-side processing - do it ourselves :-)
var nRemove = $(nTr).next()[0];
nRemove.parentNode.removeChild( nRemove );
}
else
{
// Open this row
this.src = "images/icons/details_open.png";
//Table_list_project.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
} );
} );
}
// Data.TABLE
Table_list_project=$('#data_tbl_progetti_storico').dataTable
({
"bProcessing": true,
"bServerSide": true,
"bAutoWidth": false,
"bSort":false,
"sAjaxSource": "includes/dfile.php",
"bStateSave": false,
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "id_unico", "value": id_unico });
//aoData.push( { "name": "super_add", "value": rnd_cache_damn });
$.ajax( {
"dataType": 'json',
"type": "GET",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
},
"fnDrawCallback": fnOpenClose
});
[/code]
thanks
paky
thanks all
had the same problem, thanks to your help i got it to work within minutes :)
[code]
function fnFormatDetails(nTr) {
var aData = oT.fnGetData(nTr);
var sOut;
$.ajax({
url: 'yourServiceURL',
data: '{}',
type: 'POST',
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (result) {
sOut = 'Detailed information: ' + result;
oT.fnOpen(nTr, sOut, 'details');
}
});
}
[/code]