Table Tools with Drill Down rows - How to initiate it?
Table Tools with Drill Down rows - How to initiate it?
dthunsterblich
Posts: 20Questions: 0Answers: 0
Hey!
I set up a datatables with server side script and drill down rows. Is there a way to combine Drill Down Rows (details) with Table Tools? I use the pdf and print function. The print function seems to work okay. It displays the rows and If I want to print the details I open it via click. On the other hand the output PDF just contains the rows without any detail row...
So my question is, how do I configure Talbe Tools to display it correctly?
[code]
...
"aButtons": [ {
"sExtends": "pdf",
"mColumns": [3,4,5,6,7,8,9],
"sPdfOrientation": "landscape",
"sButtonText": "create PDF"
}]
...
[/code]
I set up a datatables with server side script and drill down rows. Is there a way to combine Drill Down Rows (details) with Table Tools? I use the pdf and print function. The print function seems to work okay. It displays the rows and If I want to print the details I open it via click. On the other hand the output PDF just contains the rows without any detail row...
So my question is, how do I configure Talbe Tools to display it correctly?
[code]
...
"aButtons": [ {
"sExtends": "pdf",
"mColumns": [3,4,5,6,7,8,9],
"sPdfOrientation": "landscape",
"sButtonText": "create PDF"
}]
...
[/code]
This discussion has been closed.
Replies
Thanks
i'm sorry I couldn't solve it. In fact for my current project it is not needed anymore.
Still I would be very interested in a solution.
Best wishes
After fiddling around and lots of trial and error, i figured out that in the
Tabletools.js there is this var on the initialization,oConfig.bOpenRows . If you set this one to true then on the export method will print out the drill downs that are open (spit out the exact thing you injected in the beginning, so some formatting will be required).
I set the parameter for open rows directly in the "aButtons" initialization:
[code]
"aButtons": [ {
"sExtends": "pdf",
"bOpenRows": true
}]
[/code]
Thanks for the solution!
there will be a loop that will process all the drilldown data. In my example i was inserting another table on the drilldown and added code it so it would spit it out on the following format
a a a
b b b
x x
c c c
where x is the drilldown data and a,b,c are regular collumns
here is the code i added.
[code]
if ( oConfig.bOpenRows )
{
arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; });
if ( arr.length === 1 )
{
sLoopData = "\t\t"+ this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex );
sLoopData.replace(/\n/g," ");
sLoopData = sLoopData.replace( "", "" );
sLoopData = sLoopData.replace( /<.tr>/g, "\n\t\t" );
sLoopData = sLoopData.replace( /<.th>/g, "\t" );
sLoopData = sLoopData.replace( /<.td>/g, "\t" );
sLoopData = sLoopData.replace( /<.*?>/g, "" );
aData.push( sLoopData );
}
}
[/code]
which is replacing some table tags for new line and new rows and then at the end, it will remove the unseeded tags. Not the cleanest way of doing it, it was my first time using regex, but it got the job done for me. Hope this can help
Cheers.