1

So I've been through all sorts of questions just like this one from over the years, and I can't figure out what my order should be. My dropdown menus aren't working, and neither is the styling for my data tables. I'm using bootstrap-sass 3.3.7 and bootstrap-will_paginate 1.0.0

Here is my current order in application.js

 //= require jquery
 //= require parsley
 //= require jquery-ui
 //= require bootstrap
 //= require bootstrap/dropdown
 //= require dataTables/jquery.dataTables
 //= require_tree .

In applications css I have:

  *= require jquery-ui
  *= require_self
  *= require_tree .

Recently, some important gems deprecated. So I'm in the process of fixing everything to the new standards. So I'm assuming there is something I've missed over the last few years that is messing with me. Also, when I make small changes to application.js, I can't tell if anything is changing. Do I need to run rake clean:assets every time?

Any help would be greatly appreciated.

edit. Updated my order to reflect what is current. Still haven't figured it out.

edit 2. I updated my application.css file to a .scss file, and now it looks like this:

 @import "parsley";
 @import "jquery-ui";
 @import "dataTables/jquery.dataTables";
 @import "bootstrap-sprockets";
 @import "bootstrap";
 @import "/\*";

Same results. None of my Javascript is working, bootstrap appears to be working.

edit 3. I am very close. So my javascript is working, I had to move parsley ahead of jquery, because it requires it.

So what is not working is the code for my table:

 jQuery ->
   $('#all_participant_table').DataTable({"sPaginationType": bootstrap"});
   $('#screening_log').DataTable({
     "sScrollX": "100%",
     "sScrollXInner": "100%",
     "bScrollCollapse": true,
     "sPaginationType": "bootstrap"
     });

edit 4. Errors resolved. It appears sPaginationType has deprecated, I switched to PagingType and everything worked ("pagingType": "full_numbers")

I hope this post helps someone in the future.

Ian Ellis
  • 541
  • 6
  • 19
  • what is your rails version, are you using turbolinks? – widjajayd Sep 04 '17 at 19:06
  • @widjajayd My rails version is 5.1.3, and I am not using turbolinks – Ian Ellis Sep 04 '17 at 19:09
  • Some bootstrap plugins need jquery, you have to include jquery before bootstrap in your application.js. I hope this helps – Himshwet Sep 04 '17 at 19:27
  • @Himshwet I moved all 3 of my jquery requires before Bootstrap, and recompiled everything, but it did not help. Thank you for your response though, I did not know that about bootstrap. – Ian Ellis Sep 04 '17 at 19:31
  • 1
    @IanEllis You also dont need jquery-ujs in rails 5, https://stackoverflow.com/questions/44466430/is-require-jquery-ujs-still-needed-in-rails-5-1 – Himshwet Sep 04 '17 at 19:38
  • @Himshwet Excellent. I'm not there yet, but any removed inconsistency is a step forward. – Ian Ellis Sep 04 '17 at 19:43

1 Answers1

0

Here is the answer to my original question:

//= require jquery
//= require parsley
//= require jquery-ui
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require_tree .

I had to remove bootstrap/dropdown, and jquery-ujs. Both of those items are now part of the system in one way or another. So having them again was creating a duplicate call.

Jquery needs to be before parsley and bootstrap. Both requery jquery.

For the system that I'm running (Virtual box, ubuntu), I need to at least rake assets:precompile and restart the server to see most changes. But I would do this to make sure:

 rake assets:clobber //delete cached files
 rake assets:precompile //rebuild

And then start the server.

Ian Ellis
  • 541
  • 6
  • 19