@JustLikeIcarus: Line 522 "if ( _DTSettings.aoColumns[i].bVisible )" is the key here. Just remove that and it will include your hidden data. There isn't an API method to have it to this at the moment, might I will look at possibly adding one for a future release.
Yup - you'll need to use the fnSetColumnVis ( http://datatables.net/api#fnSetColumnVis ) function to display the hidden columns. TableTools will display the table in it's current state - so you need to override that, and this function is the way to do it :-)
I reinstalled the plugin, using the same path as the demo and i still have empty files.
Print tables works fine but any files export gives me an empty file (and copy to clipboard isn't working too).
I'm using dataTables and dataTools last available version.
Firebug reports no error.
All files are loaded correctly.
I think you need to include TableTools in the sDom parameter, as in the demo:
[code]
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip'
} );
[/code]
Could you provide a link to where you have having problems. Might make things easier to debug.
Unfortunately, I can't provide a link since it's an internal tool.
Sorry, i pasted the wrong code, here's the one i'm using with tabletools :
[code] $(document).ready(function() {
goTable = $('#ordersList').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType" : "full_numbers",
"sAjaxSource": "./includes/manager.billing.php",
"iDisplayLength": 25,
"aaSorting": [[ 0, "desc" ]],
"bAutoWidth": false,
"oLanguage": {
"sLengthMenu": "Afficher _MENU_ BC par page",
"sZeroRecords": "Aucun r
Assuming that all the resources are loading okay (probably worth checking your error log to make sure there are no 404 errors, and also the 'Net' tab in Firebug or whatever debug tool you use), then this is quite odd! With server-side processing the behaviour of TableTools is slightly different since it will only give the records which are currently on display (not sure what the print will do though!), but it should still give you your 25 records or so.
So a couple of things to check:
1. No 404 errors
2. You are using Flash 10 plug-in
3. No Javascript errors anywhere
There isn't really any trace logging information in TableTools - given that it's meant to be nice an simple to use :-). Without being able to see what is going on, I rather suspect that you will need to dig around in the code using console.log() etc to find out what is going on. fnGetDataTablesData() is probably the best place to start.
I put an alert on sData after this line :
sData += _DTSettings.aoData[ _DTSettings.aiDisplay[j] ]._aData[ i ].replace(/\n/g," ").replace( /<.*?>/g, "" ) +sSeperator;
So I got one alert for each column on the first line, except for the last one (numeric column).
I can't see why I don't get any alert for the others lines.
allan> I may be able to give you a limited access to this part of the script but i'll need you to give me a login and password to use :)
It's not directly possible with tableTools since PDF generation requires PHP (using TCPDF per example).
So, tableTools would only be able to grab the data and send it (POST or GET) to a PHP script.
Now, using TCPDF, we know that an 14 page width is 192 (i never found which unity was using tcpdf).
It's easy to know how many columns are to print on the page.
The main problem would be to calculate the column size (doing 192 divided by the number of columns wouldn't always work).
Otherwise, it would be a piece of cake.
Thanks for the anwers, yes i have use a class for export to pdf, dompdf, but muy question was if inside the block of box (copy to clipboard, export to csv, etc), i can add a new box, for export to pdf with an image as the others. i'll have to change the flash file?
No.
Use the jSon data returned by the call to server_processing.php (with fnServerData by example) and send it to your php script (simply alter the js file to add your button).
Thanks, now i add a new function for expor to pdf, but one more question, how i pass a data (url) to TableTools.js from $('#example').dataTable({ }) ?..
for example i want to pass:
olisttable = $('#example').dataTable({
"iDisplayLength": 10,
"bAutoWidth":false,
"bJQueryUI": true,
"sUrlPDF":"/files/exportpdf.php", // add this parameter for send a url for export to pdf
"sPaginationType": "full_numbers",
"sDom": 'T<"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>'
});
});
and receive in TableTools
var TableToolsInit = {
"oFeatures": {
"bPdf": true,
"bCsv": true,
"bXls": true,
"bCopy": true,
"bPrint": true
},
"sPrintMessage": "",
"sTitle": "",
"sUrlPDF":"", /// here ???
"sSwfPath": "/swf/ZeroClipboard.swf",
"iButtonHeight": 30,
"iButtonWidth": 30,
"_iNextId": 1 /* Internal useage - but needs to be global */
};
It would actually be possible to add PDF output to TableTools by modifying the ZerClipboard.fla file to input the option to output to PDF (this can be done in ActionScript as well as any other language - for example: http://alivepdf.bytearray.org/ ). So what you would do is add a new button to TableTools, and set a new output type in the swf (the current two are save as text file and copy to clip-board), to save as a PDF, and then that's it done.
It might be a bit complicated to do - but it's certainly possible. The other option is to pass the whole lot to a server-side process and have that render your PDF for you. The problem with including this in TableTools as a package, would be that I would only be able to provide limited customisation of the PDF - so far better that anyone who wants this support can add it - hooray for open source :-)
@harklick: I'd say it was actually easier to just put your URL in TableTools rather than the DataTables initialiser, unless there is a good reason to put it in there? If there is then you'll need to add it into the settings object and access that in TableTools.
thanks for your answers Allan, the url that i want pass should be dinamic, can change,
is why i want pass the url in the file that put the url here
olisttable = $('#example').dataTable({
"iDisplayLength": 10,
"bAutoWidth":false,
"bJQueryUI": true,
"sUrlPDF":"/exportpdffile.php", // this
so, when i click the pdf button call the url pass in sUrlPDF x example, and the result is a PDF file.
in this file, is the code for generate pdf por example:
exportpdffile.php:
require_once("libraries/dompdf/dompdf_config.inc.php");
if (isset ($_GET['date']))
{
$objReferrals = new Referrals();
$listRef = $objReferrals->listReferralsByMsoandDate($mso_code, $_GET['date']);
thanks a lot for everything, i can solved my problem ;), i could put a new button in the box with an image of pdf, and could add an url dynamically for this button.
Replies
Try to download the last version and try again.
Is there a way to enable a debug ?
Is there an easy way to have the print or save as functions include the hidden columns as well? If not do you have any recommendations on doing so.?
Allan
Allan
Print tables works fine but any files export gives me an empty file (and copy to clipboard isn't working too).
I'm using dataTables and dataTools last available version.
Firebug reports no error.
All files are loaded correctly.
I only have one hundred lines.
What am i missing ?
Here's my code :
[code] $(document).ready(function() {
goTable = $('#ordersList').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType" : "full_numbers",
"sAjaxSource": "./includes/server_processing.php",
"iDisplayLength": 25,
"aaSorting": [[ 0, "desc" ]],
"bAutoWidth": false,
"aoColumns": [
{ sWidth: '30px', sClass: 'orderAction' },
{ sWidth: null, sClass: 'master' },
{ sWidth: '110px' },
{ sWidth: null },
{ sWidth: '16px' },
{ sWidth: '16px', bSortable: false },
{ sWidth: '40px', bSortable: false }
]
} );
$('#filter_norm input').keyup( fnFilterNormal );
} );[/code]
I think you need to include TableTools in the sDom parameter, as in the demo:
[code]
$('#example').dataTable( {
"sDom": 'T<"clear">lfrtip'
} );
[/code]
Could you provide a link to where you have having problems. Might make things easier to debug.
Allan
Sorry, i pasted the wrong code, here's the one i'm using with tabletools :
[code] $(document).ready(function() {
goTable = $('#ordersList').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sPaginationType" : "full_numbers",
"sAjaxSource": "./includes/manager.billing.php",
"iDisplayLength": 25,
"aaSorting": [[ 0, "desc" ]],
"bAutoWidth": false,
"oLanguage": {
"sLengthMenu": "Afficher _MENU_ BC par page",
"sZeroRecords": "Aucun r
Assuming that all the resources are loading okay (probably worth checking your error log to make sure there are no 404 errors, and also the 'Net' tab in Firebug or whatever debug tool you use), then this is quite odd! With server-side processing the behaviour of TableTools is slightly different since it will only give the records which are currently on display (not sure what the print will do though!), but it should still give you your 25 records or so.
So a couple of things to check:
1. No 404 errors
2. You are using Flash 10 plug-in
3. No Javascript errors anywhere
Regards,
Allan
I have flash version 10.0.32.18 (10.0 r32).
Is there an easy way to enable a debug ?
There isn't really any trace logging information in TableTools - given that it's meant to be nice an simple to use :-). Without being able to see what is going on, I rather suspect that you will need to dig around in the code using console.log() etc to find out what is going on. fnGetDataTablesData() is probably the best place to start.
Regards,
Allan
sData += _DTSettings.aoData[ _DTSettings.aiDisplay[j] ]._aData[ i ].replace(/\n/g," ").replace( /<.*?>/g, "" ) +sSeperator;
So I got one alert for each column on the first line, except for the last one (numeric column).
I can't see why I don't get any alert for the others lines.
allan> I may be able to give you a limited access to this part of the script but i'll need you to give me a login and password to use :)
If you could, that would be most useful. You can send it to me direct using: http://datatables.net/contact .
Regards,
Allan
Thanks.
So, tableTools would only be able to grab the data and send it (POST or GET) to a PHP script.
Now, using TCPDF, we know that an 14 page width is 192 (i never found which unity was using tcpdf).
It's easy to know how many columns are to print on the page.
The main problem would be to calculate the column size (doing 192 divided by the number of columns wouldn't always work).
Otherwise, it would be a piece of cake.
Use the jSon data returned by the call to server_processing.php (with fnServerData by example) and send it to your php script (simply alter the js file to add your button).
You can take fnFeaturePrint as example.
for example i want to pass:
olisttable = $('#example').dataTable({
"iDisplayLength": 10,
"bAutoWidth":false,
"bJQueryUI": true,
"sUrlPDF":"/files/exportpdf.php", // add this parameter for send a url for export to pdf
"sPaginationType": "full_numbers",
"sDom": 'T<"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>'
});
});
and receive in TableTools
var TableToolsInit = {
"oFeatures": {
"bPdf": true,
"bCsv": true,
"bXls": true,
"bCopy": true,
"bPrint": true
},
"sPrintMessage": "",
"sTitle": "",
"sUrlPDF":"", /// here ???
"sSwfPath": "/swf/ZeroClipboard.swf",
"iButtonHeight": 30,
"iButtonWidth": 30,
"_iNextId": 1 /* Internal useage - but needs to be global */
};
thats corrects?, becouse doesnt work for me
It would actually be possible to add PDF output to TableTools by modifying the ZerClipboard.fla file to input the option to output to PDF (this can be done in ActionScript as well as any other language - for example: http://alivepdf.bytearray.org/ ). So what you would do is add a new button to TableTools, and set a new output type in the swf (the current two are save as text file and copy to clip-board), to save as a PDF, and then that's it done.
It might be a bit complicated to do - but it's certainly possible. The other option is to pass the whole lot to a server-side process and have that render your PDF for you. The problem with including this in TableTools as a package, would be that I would only be able to provide limited customisation of the PDF - so far better that anyone who wants this support can add it - hooray for open source :-)
Regards,
Allan
Allan
is why i want pass the url in the file that put the url here
olisttable = $('#example').dataTable({
"iDisplayLength": 10,
"bAutoWidth":false,
"bJQueryUI": true,
"sUrlPDF":"/exportpdffile.php", // this
so, when i click the pdf button call the url pass in sUrlPDF x example, and the result is a PDF file.
in this file, is the code for generate pdf por example:
exportpdffile.php:
require_once("libraries/dompdf/dompdf_config.inc.php");
if (isset ($_GET['date']))
{
$objReferrals = new Referrals();
$listRef = $objReferrals->listReferralsByMsoandDate($mso_code, $_GET['date']);
$html = '
Prueba 2
body
{
font-size:10px;
margin-top: 40px;
margin-bottom: 20px;
}
table, th, td {
border: 1px solid #D4E0EE;
border-
......
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("ReferralsByMsoandDate.pdf");
how can i do that?, is posible?
Nice one - good to hear that's sorted.
Regards,
Allan