Unable to get the TableTools to work...
Unable to get the TableTools to work...
TarponWebGuy
Posts: 10Questions: 0Answers: 0
Hi Allan,
I'm currently using your DataTable plugin at version 1.9.0, which I love! However, I was trying to add the extra TableTools and I couldn't get the "Copy, CSV, Excel, PDF" buttons to work on any browser except for Google Chrome. Google Chrome will work occasionally, but not all the time... The print button works fine on all of my browsers. I used firebug (on firefox) and the error console (on Google) to see if there was any errors, and there were none. Below is the code I'm using to initiate the table:
[code]
google.load("jquery", "1.7.1");
jQuery.fn.dataTableExt.oSort['title-numeric-asc'] = function(a,b) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
var y = b.match(/title="*(-?[0-9\.]+)/)[1];
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['title-numeric-desc'] = function(a,b) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
var y = b.match(/title="*(-?[0-9\.]+)/)[1];
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
$(document).ready(function() {
$('#Example').dataTable({
"aaSorting": [[0,'desc'],[1,'desc']],
"aoColumns": [
null,
{ "sType": "title-numeric" },
null,
null
],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "datatable/swf/copy_cvs_xls_pdf.swf"
},
"iDisplayLength": 25,
"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
});
});
[/code]
I've double checked to see if the "sSwfPath" is on the right path, and it is but no luck... Your TableTools examples work on all of my browsers, so I know it's an issue from my end. I'm not sure what else to do to fix the problem... I really need the CSV feature and I'm open to any suggestions. Please let me know if there is anything else I can do to fix the problem. Thank you for your time!
Steven
I'm currently using your DataTable plugin at version 1.9.0, which I love! However, I was trying to add the extra TableTools and I couldn't get the "Copy, CSV, Excel, PDF" buttons to work on any browser except for Google Chrome. Google Chrome will work occasionally, but not all the time... The print button works fine on all of my browsers. I used firebug (on firefox) and the error console (on Google) to see if there was any errors, and there were none. Below is the code I'm using to initiate the table:
[code]
google.load("jquery", "1.7.1");
jQuery.fn.dataTableExt.oSort['title-numeric-asc'] = function(a,b) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
var y = b.match(/title="*(-?[0-9\.]+)/)[1];
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['title-numeric-desc'] = function(a,b) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
var y = b.match(/title="*(-?[0-9\.]+)/)[1];
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
$(document).ready(function() {
$('#Example').dataTable({
"aaSorting": [[0,'desc'],[1,'desc']],
"aoColumns": [
null,
{ "sType": "title-numeric" },
null,
null
],
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
"sSwfPath": "datatable/swf/copy_cvs_xls_pdf.swf"
},
"iDisplayLength": 25,
"aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]]
});
});
[/code]
I've double checked to see if the "sSwfPath" is on the right path, and it is but no luck... Your TableTools examples work on all of my browsers, so I know it's an issue from my end. I'm not sure what else to do to fix the problem... I really need the CSV feature and I'm open to any suggestions. Please let me know if there is anything else I can do to fix the problem. Thank you for your time!
Steven
This discussion has been closed.
Replies
[code]
.container {
display:none;
}
[/code]
I did some more digging to fix the issue and it looks like I would need to apply "fnResizeButtons". Is this the best way to go?
Allan
Allan
[code]
$(window).load(function () {
$.PadeLoaded();
$('div.container').fadeIn('slow');
var height = $('div.active_view').height(); // get the height after the content has been added
$('div.st_view').css('height', height+'px'); // set the new height on the content container
var TableTools1 = TableTools.fnGetInstance( 'Table' );
TableTools1.fnResizeButtons();
});
[/code]
Thanks again, Allan!