1

I have a Rails 4 app using Bootstrap 3 and the gem 'jquery-datatables-rails'.

This is my javascript:

  $("#dataTable1").dataTable
    bfilter: true
    bLengthChange: true
    scrollY:        "300px"
    paging: false
    oColVis:
      buttonText: "Hide/Show"
      bRestore: true
    sDom: "C<\"clear\">lfrTtiXp"
    oTableTools:
      aButtons: [
        "xls"
      ,
        sExtends: "pdf"
        sPdfOrientation: "landscape"
        sPdfMessage: "pdf"
        mColumns: "visible"
      ]

This is the error I'm getting:

Failed to load resource: the server responded with a status of 404 (Not Found) 
http://burtondav.myevdata.dev/swf/copy_csv_xls_pdf.swf

The file is in the external libraries:

enter image description here

Thanks for the help!

UPDATE1

This is my application.js:

//= require dataTables/jquery.dataTables
//= require dataTables/extras/dataTables.tableTools
//= require dataTables/extras/dataTables.colVis
//= require dataTables/extras/dataTables.colReorder
//= require dataTables/extras/dataTables.keyTable
//= require dataTables/extras/dataTables.responsive
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap

And application.css:

 *= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
 *= require dataTables/extras/dataTables.tableTools
 *= require dataTables/extras/dataTables.colVis
 *= require dataTables/extras/dataTables.colReorder
 *= require dataTables/extras/dataTables.keyTable
 *= require dataTables/extras/dataTables.responsive
creimers
  • 4,975
  • 4
  • 33
  • 55
Reddirt
  • 5,913
  • 9
  • 48
  • 126
  • Have you setup the `application.js` and `application.css` files correctly? https://github.com/rweng/jquery-datatables-rails#general-installation – Omid Kamangar Sep 28 '14 at 14:48
  • What version of 'jquery-datatables-rails' are you using? 2.2.3 has some breaking upgrades. I think I'll post a reference as an answer for you. Hope it helps. – Richard_G Oct 03 '14 at 09:36
  • Did you ever make it work? – ErnestoE Jun 24 '15 at 21:06

2 Answers2

1

I just converted from jquery-datatables-rails 2.2.1 to 2.2.3 to get to DataTables 1.10.2. I found some breaking issues in that conversion, especially related to variable names. DataTables 1.10 renamed many of its variables, but provides backward compatible support to 1.9. However, jquery-datatables-rails does not maintain that backward compatibility.

I noticed you are using the old naming conventions. I didn't experience the specific problem that you mentioned, but I did find many others and may have just not hit this one. So, if you are using 2.2.3, which I would recommend, please reference Upgrading to jquery-datatables-rails 2.2.3.

There is another possible answer here. From the image you provided, it looks like you are using RubyMine. I'm at 6.3.3 and there is a known problem with a fix developed but not yet released. Reference Cannot resolve file in RubyMine. Also, this is the JetBrains issue.

Hope it helps.

Community
  • 1
  • 1
Richard_G
  • 4,700
  • 3
  • 42
  • 78
0

swf never worked for me with bootstrap. I attempted with bootstrap 2 and recently with bootstrap 3. So, I removed the bootstrap styling using the data tables default styling provided by and VOILA! The swf showed up in above or below my table, depending of my dom.

L.D
  • 1,279
  • 3
  • 15
  • 31
  • I removed this line `"sPaginationType": "bootstrap"` and Rails still can't find the file. Is that the right step? – Reddirt Oct 09 '14 at 13:32
  • I also removed `//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap` and `*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap` - still have the same issue. – Reddirt Oct 09 '14 at 13:42
  • I set jqueryUI=false and used Bootstrap styling which resolved many/most of my problems but not all. – Richard_G Feb 05 '15 at 22:34