Row details shows "undefined"...
Row details shows "undefined"...

Hi Alan,
First of all, I thank you for creating such an elegant solution which is unmatched in my experience!
I have been using "Row details" http://www.datatables.net/examples/api/row_details.html
I modified fnFormatDetails() to use AJAX (getJSON)
I get "undefined" as output...
Here is the code:
[code]function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
$.getJSON("",
function(data) {
var sOut = '';
sOut+=...
sOut += '';
return sOut;
});
}[/code]
When I alert sOut value, I can see the table with headers and data...
The AJAX code works fine as I can see well formed JSON string in firebug(alson in JSON tab). Can you tell where am I going wrong?
First of all, I thank you for creating such an elegant solution which is unmatched in my experience!
I have been using "Row details" http://www.datatables.net/examples/api/row_details.html
I modified fnFormatDetails() to use AJAX (getJSON)
I get "undefined" as output...
Here is the code:
[code]function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
$.getJSON("",
function(data) {
var sOut = '';
sOut+=...
sOut += '';
return sOut;
});
}[/code]
When I alert sOut value, I can see the table with headers and data...
The AJAX code works fine as I can see well formed JSON string in firebug(alson in JSON tab). Can you tell where am I going wrong?
This discussion has been closed.
Replies
The following code works!
[code]function fnFormatDetails ( oTable, nTr )
{
var aData = oTable.fnGetData( nTr );
var sOut = '';
$.ajaxSetup({ // Since getJSON is asynchronous by default set async: false
async: false,
"error":function() {
alert("error");
}});
$.getJSON("",
function(data) {
sOut+=...
sOut += '';
});
return sOut;
}[/code]
Allan