jquery Datatables not formatted until browser refresh
up vote
0
down vote
favorite
I'm on Rails 5.2, MacOS 10.13.4, ruby 2.3.7p456. I am following this guide for implementing jquery datatables. Both in development and production, the tables load without datatable formatting, but after a browswer refresh, the tables display perfectly with the datatable formatting. I'm installing using the CDN.
Here is a screenshot on inital load:
Then after refresh:
My application.html.erb:
<head>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
In my html the table has id = 'search'
the search.coffee file:
$(document).ready ->
$('#search').DataTable()
return
and finally the application.js file:
//= require jquery3
//= require popper
//= require bootstrap
//= require rails-ujs
//= require jquery.turbolinks
//= require turbolinks
//= require_tree .
I have tried moving the CDN scripts from the application.html.erb to the show page, removing the load jquery script, and using different versions of jquery in the load jquery script. I've tried on Chrome Version 67.0.3396.79 and Safari Version 11.1. All of these resulted in no change.
Has anyone run into this? I saw this question: and tried adding gem 'jquery-turbolinks'
to gemfile and adding //= require jquery.turbolinks
to application.js, and after bundle install and restarting the server, still no change.
datatables ruby-on-rails-5.2
add a comment |
up vote
0
down vote
favorite
I'm on Rails 5.2, MacOS 10.13.4, ruby 2.3.7p456. I am following this guide for implementing jquery datatables. Both in development and production, the tables load without datatable formatting, but after a browswer refresh, the tables display perfectly with the datatable formatting. I'm installing using the CDN.
Here is a screenshot on inital load:
Then after refresh:
My application.html.erb:
<head>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
In my html the table has id = 'search'
the search.coffee file:
$(document).ready ->
$('#search').DataTable()
return
and finally the application.js file:
//= require jquery3
//= require popper
//= require bootstrap
//= require rails-ujs
//= require jquery.turbolinks
//= require turbolinks
//= require_tree .
I have tried moving the CDN scripts from the application.html.erb to the show page, removing the load jquery script, and using different versions of jquery in the load jquery script. I've tried on Chrome Version 67.0.3396.79 and Safari Version 11.1. All of these resulted in no change.
Has anyone run into this? I saw this question: and tried adding gem 'jquery-turbolinks'
to gemfile and adding //= require jquery.turbolinks
to application.js, and after bundle install and restarting the server, still no change.
datatables ruby-on-rails-5.2
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm on Rails 5.2, MacOS 10.13.4, ruby 2.3.7p456. I am following this guide for implementing jquery datatables. Both in development and production, the tables load without datatable formatting, but after a browswer refresh, the tables display perfectly with the datatable formatting. I'm installing using the CDN.
Here is a screenshot on inital load:
Then after refresh:
My application.html.erb:
<head>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
In my html the table has id = 'search'
the search.coffee file:
$(document).ready ->
$('#search').DataTable()
return
and finally the application.js file:
//= require jquery3
//= require popper
//= require bootstrap
//= require rails-ujs
//= require jquery.turbolinks
//= require turbolinks
//= require_tree .
I have tried moving the CDN scripts from the application.html.erb to the show page, removing the load jquery script, and using different versions of jquery in the load jquery script. I've tried on Chrome Version 67.0.3396.79 and Safari Version 11.1. All of these resulted in no change.
Has anyone run into this? I saw this question: and tried adding gem 'jquery-turbolinks'
to gemfile and adding //= require jquery.turbolinks
to application.js, and after bundle install and restarting the server, still no change.
datatables ruby-on-rails-5.2
I'm on Rails 5.2, MacOS 10.13.4, ruby 2.3.7p456. I am following this guide for implementing jquery datatables. Both in development and production, the tables load without datatable formatting, but after a browswer refresh, the tables display perfectly with the datatable formatting. I'm installing using the CDN.
Here is a screenshot on inital load:
Then after refresh:
My application.html.erb:
<head>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.js"></script>
In my html the table has id = 'search'
the search.coffee file:
$(document).ready ->
$('#search').DataTable()
return
and finally the application.js file:
//= require jquery3
//= require popper
//= require bootstrap
//= require rails-ujs
//= require jquery.turbolinks
//= require turbolinks
//= require_tree .
I have tried moving the CDN scripts from the application.html.erb to the show page, removing the load jquery script, and using different versions of jquery in the load jquery script. I've tried on Chrome Version 67.0.3396.79 and Safari Version 11.1. All of these resulted in no change.
Has anyone run into this? I saw this question: and tried adding gem 'jquery-turbolinks'
to gemfile and adding //= require jquery.turbolinks
to application.js, and after bundle install and restarting the server, still no change.
datatables ruby-on-rails-5.2
datatables ruby-on-rails-5.2
asked Jun 12 at 14:05
tomb
776616
776616
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
Responding on this from the answer over here - Rails 5: how to use $(document).ready() with turbo-links
At some point the $(document).ready call was depreciated with turbolinks, try:
$( document ).on('turbolinks:load', function()
console.log("It works on each visit!")
)
add a comment |
up vote
0
down vote
accepted
I completely removed turbolinks from my app in order to get the datatables to act properly.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Responding on this from the answer over here - Rails 5: how to use $(document).ready() with turbo-links
At some point the $(document).ready call was depreciated with turbolinks, try:
$( document ).on('turbolinks:load', function()
console.log("It works on each visit!")
)
add a comment |
up vote
1
down vote
Responding on this from the answer over here - Rails 5: how to use $(document).ready() with turbo-links
At some point the $(document).ready call was depreciated with turbolinks, try:
$( document ).on('turbolinks:load', function()
console.log("It works on each visit!")
)
add a comment |
up vote
1
down vote
up vote
1
down vote
Responding on this from the answer over here - Rails 5: how to use $(document).ready() with turbo-links
At some point the $(document).ready call was depreciated with turbolinks, try:
$( document ).on('turbolinks:load', function()
console.log("It works on each visit!")
)
Responding on this from the answer over here - Rails 5: how to use $(document).ready() with turbo-links
At some point the $(document).ready call was depreciated with turbolinks, try:
$( document ).on('turbolinks:load', function()
console.log("It works on each visit!")
)
answered Nov 11 at 15:32
patrickmult
313
313
add a comment |
add a comment |
up vote
0
down vote
accepted
I completely removed turbolinks from my app in order to get the datatables to act properly.
add a comment |
up vote
0
down vote
accepted
I completely removed turbolinks from my app in order to get the datatables to act properly.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
I completely removed turbolinks from my app in order to get the datatables to act properly.
I completely removed turbolinks from my app in order to get the datatables to act properly.
answered Sep 4 at 2:39
tomb
776616
776616
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50819170%2fjquery-datatables-not-formatted-until-browser-refresh%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown