Tabletools buttons not displaying

Tabletools buttons not displaying

dinatarunidinataruni Posts: 5Questions: 0Answers: 0
edited October 2013 in TableTools
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?

Replies

  • dinatarunidinataruni Posts: 5Questions: 0Answers: 0
    Here is the test: http://live.datatables.net/erenuy/3/edit
  • fab1970fab1970 Posts: 5Questions: 0Answers: 0
    same problem here... pratically the same code and nothing on screen
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    If I correct the various errors on the page, strip the HTML back to just a plain table and include the required files, it works okay for me: http://live.datatables.net/erenuy/4/edit . Not styled, but that just needs a stylesheet inclusion.

    Allan
  • fab1970fab1970 Posts: 5Questions: 0Answers: 0
    hi Allan,
    I still don't see the buttons on screen on the live example; browser or security problem
    maybe ?

    regards
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Above the "Product Name" column. Is says "Copy Print Save". As I say, there is a styling issue there, but just include the stylesheet.

    Allan
  • fab1970fab1970 Posts: 5Questions: 0Answers: 0
    don't take me wrong Allan,I don't see "Copy Print Save".
  • dinatarunidinataruni Posts: 5Questions: 0Answers: 0
    Hi 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
  • fab1970fab1970 Posts: 5Questions: 0Answers: 0
    Hi 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 ? :)
  • dinatarunidinataruni Posts: 5Questions: 0Answers: 0
    I don't see it in either Safari or Chrome. In Firefox I see the words "Copy Print Save" but if I click on them, the only button that causes any action to happen is Print.
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    ? if I click on them, the only button that causes any action to happen is Print.

    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
  • fab1970fab1970 Posts: 5Questions: 0Answers: 0
    edited October 2013
    In my case, it's hopless
  • dinatarunidinataruni Posts: 5Questions: 0Answers: 0
    Thanks, Allan. It still doesn't work in Chrome for me but works in all my other browsers - Safari, IE, Firefox. I thought maybe my Chrome wasn't updated so I updated it but still no buttons. I'm just going to work in Firefox for now. Leave the mystery for another day.
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    Very odd - not sure why that is - sorry! Do the demo pages work for you: http://datatables.net/extras/tabletools/ ?

    Allan
  • nashirnashir Posts: 4Questions: 0Answers: 0
    how to add column
  • allanallan Posts: 63,383Questions: 1Answers: 10,449 Site admin
    @nashir - please do not cross post. Also that question is not relevant to this discussion.
This discussion has been closed.