Change I would prefer to use loading for this function, if possible, since I have a boot file in my project. It seems like I could just miss something to use javascript bootstrap in my rails project.
When you click on a column name, the table should sort the data by the name of this column. The table below is:

I tried to sort the data using bootstrap following the examples below on this website , but it did not work for me. What am I missing?
Relevant gems in my gemfile:
#Gemfile gem 'bootstrap-sass' gem 'autoprefixer-rails'
CSS
#app/assets/stylesheets/application.css.scss @import "bootstrap-sprockets"; @import "bootstrap";
JavaScript:
#app/assets/javascripts/application.js
View Record Display:
#app/views/index.html.erb <h4>Listing Users</h4> <table class=" table table-striped" data-sort-name="name" data-sort-order="desc"> <thead> <tr> <th data-field="name" data-sortable="true">Name</th> <th data-field="age" data-sortable="true">Age</th> </tr> </thead> <tbody> <% @users.each do |user| %> <tr> <td><%= user.name %></td> <td><%= user.age %></td> </tr> <% end %> </tbody> </table> <br> <%= link_to 'New User', new_user_path %>
source share