Tabletools buttons not displaying
Tabletools buttons not displaying
dinataruni
Posts: 5Questions: 0Answers: 0
Hello all,
I'm fairly new to coding and I'm working in rails. I bundle installed the datatables gem and datatables itself works like a charm. However, when I tried to use TableTools, absolutely nothing happens. I don't get any errors or anything ... just nothing happens.
Here is my application js:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require dataTables/jquery.dataTables
//= require dataTables/extras/TableTools
//= require dataTables/extras/ZeroClipboard
//= require jquery-ui
//= require_tree .
application.css:
*= require_self
*= require dataTables/jquery.dataTables
*= require dataTables/extras/TableTools
*= require dataTables/extras/TableTools_JUI
*= require_tree .
*/
and my index.html.erb:
Products
$(document).ready( function () {
$('#products').dataTable( {
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
{"sSwfPath": "media/swf/copy_csv_xls_pdf.swf"}
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": 'Save ',
"aButtons": [ "csv", "xls", "pdf" ]
}
]
}
} );
} );
Product Name
Category
Release Date
Price
<% @products.each do |product| %>
<%= product.productname %>
<%= product.category %>
<%= product.releasedate %>
<%= product.price %>
<%= link_to 'Show', product %>
<%= link_to 'Edit', edit_product_path(product) %>
<%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
<%= link_to 'New Product', new_product_path %>
The table works beautifully, but I cannot for the life of me figure out why the buttons don't show up. Am I missing something very very very basic?
I know it's finding the tabletools.js and zeroclipboard files fine because I can see them load when I watch the terminal. I tried changing the filenames to gobbledegook to make sure something was happening and sure enough I got errors. No errors as is. No buttons either.
Help please?
I'm fairly new to coding and I'm working in rails. I bundle installed the datatables gem and datatables itself works like a charm. However, when I tried to use TableTools, absolutely nothing happens. I don't get any errors or anything ... just nothing happens.
Here is my application js:
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require dataTables/jquery.dataTables
//= require dataTables/extras/TableTools
//= require dataTables/extras/ZeroClipboard
//= require jquery-ui
//= require_tree .
application.css:
*= require_self
*= require dataTables/jquery.dataTables
*= require dataTables/extras/TableTools
*= require dataTables/extras/TableTools_JUI
*= require_tree .
*/
and my index.html.erb:
Products
$(document).ready( function () {
$('#products').dataTable( {
"sDom": "<'row-fluid'<'span6'T><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
"oTableTools": {
{"sSwfPath": "media/swf/copy_csv_xls_pdf.swf"}
"aButtons": [
"copy",
"print",
{
"sExtends": "collection",
"sButtonText": 'Save ',
"aButtons": [ "csv", "xls", "pdf" ]
}
]
}
} );
} );
Product Name
Category
Release Date
Price
<% @products.each do |product| %>
<%= product.productname %>
<%= product.category %>
<%= product.releasedate %>
<%= product.price %>
<%= link_to 'Show', product %>
<%= link_to 'Edit', edit_product_path(product) %>
<%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %>
<% end %>
<%= link_to 'New Product', new_product_path %>
The table works beautifully, but I cannot for the life of me figure out why the buttons don't show up. Am I missing something very very very basic?
I know it's finding the tabletools.js and zeroclipboard files fine because I can see them load when I watch the terminal. I tried changing the filenames to gobbledegook to make sure something was happening and sure enough I got errors. No errors as is. No buttons either.
Help please?
This discussion has been closed.
Replies
Allan
I still don't see the buttons on screen on the live example; browser or security problem
maybe ?
regards
Allan
Same issue - I'm not seeing it on your edit. When I view your edit, this is all that shows: http://imgur.com/bpVFSqQ - Why does it display on your computer and not either of ours?
Thanks,
Dina
I think it's a browser issue; with firefox, I see the button indeed.
Must have a problem with the IE9 version imposed on my office computer ... maybe yours too ?
Allan, any suggestion ? :)
The sSwfPath used in the example isn't valid since the swf file isn't in that location. You'd point it to where it is on your server.
The buttons appear to work for me in IE9 and Chrome. Possibly a browser cache issue? I've cloned it into a different URL: http://live.datatables.net/idotal/edit#javascript,html .
Allan
Allan