Drill down rows : JSON format correct but don't display

Drill down rows : JSON format correct but don't display

CandyCHCandyCH Posts: 2Questions: 0Answers: 0
edited July 2013 in General
Hello people,

This is one week I'm looking for the solution to debug my little problem.

My english is bad, but the code is talking:
JavaScript cod:
[code]
var oTable = $('#example').dataTable( {
"bProcessing": true,
"bJQueryUI": true,
"sAjaxSource": "../controleur_display.php",
"sAjaxDataProp": "aaData",
"aoColumns": [
{
"mDataProp": null,
"sClass": "control center",
"sDefaultContent": ''
},
{ "mDataProp": "favorit.favoritName" },
{ "mDataProp": "favorit.date" },
{ "mDataProp": "favorit.periodicity" }
]
});
alert("");
$('#example td.control').on('click', function () {
var nTr = this.parentNode;
var i = $.inArray( nTr, anOpen );

if ( i === -1 ) {
$('img', this).attr( 'src', sImageUrlClose);
var nDetailsRow = oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details');
$('div.innerDetails', nDetailsRow).slideDown();
oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr, 1), 'details' );
anOpen.push( nTr );
}
else {
$('img', this).attr( 'src', sImageUrlOpen);
$('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 =
''+
''+
'Reports id:'+oData.report.id+''+
'Reports names:'+oData.report.reportName+''+
'Components names:'+oData.component.componentName+''+
'Streams names:'+oData.stream.streamName+''+
''+
'';
return sOut;
}
[/code]

Here I have a part of the JSON (good formated) response given by AJAX:
[code]
{
"aaData": {
"favorit": [
{
"id": "f1",
"favoritName": "nouveauFavorit1",
"report": [
{
"id": "r0",
"reportName": "ListCallProcessReport",
"xPath": "",
"description": ""
},
{
"id": "r1",
"reportName": "ListCommunicationProtocolReport",
"xPath": "",
"description": ""
}
],
"component": {
"id": "c1",
"componentName": "nouveauComposant",
"description": "Petite description"
},
"stream": [
{
"id": "s1",
"streamName": "newStream",
"streamPath": "//Path/stream/to/target",
"description": "A zero description"
},
{
"id": "s2",
"streamName": "newStream2",
"streamPath": "//Path/stream/to/target",
"description": "A zero description"
}
],
"date": "13-06-2013",
"periodicity": "M1"
},
{
"id": "f2",
"favoritName": "nouveauFavorit2",
"report": {
"id": "r3",
"reportName": "ListEndpointConnectionsReport",
"xPath": "",
"description": ""
},
"component": {
"id": "c2",
"componentName": "nouveauComposant",
"description": "Petite description"
},
"stream": [
{
"id": "s4",
"streamName": "newStream",
"streamPath": "//Path/stream/to/target",
"description": "A zero description"
},
{
"id": "s5",
"streamName": "newStream",
"streamPath": "//Path/stream/to/target",
"description": "A zero description"
}
],
"date": "13-06-2013",
"periodicity": "M1"
}
]
}
}
[/code]

Here is the link for debuger tool: http://debug.datatables.net/uyoceb

Surely I miss something and I did not well understand the documentation, but if you could give my the way to go right, I will appreciate.

Sorry to take your time and thank you for all kind of response.
Best regards
Daniel R.

I

Replies

  • CandyCHCandyCH Posts: 2Questions: 0Answers: 0
    I just change "sAjaxDataPro" : "aaData" -> "aaData.favorit".

    Sorry for the useless post.

    Daniel R.
This discussion has been closed.