title: Sort table data by columns in rails with bootstrap
body: <p><strong>Edit</strong>: I would prefer to using bootstrap for this functionality if possible since I have bootstrap in my project.  It seems like I might just be missing something to utilize bootstrap's javascript within my rails project.</p>
  
  <p>When the column name is clicked, the table should sort the data by that column name. Below is the table: </p>
  
  <p><img src="https://i.stack.imgur.com/nNGuB.png" alt="enter image description here"></p>
  
  <p>I attempted to sort the data with bootstrap, following  the examples shown <a href="http://wenzhixin.net.cn/p/bootstrap-table/docs/examples.html#sort-table" rel="noreferrer">at this website</a>, but it wasn't working for me. What am I missing?</p>
  
  <p>Relevant gems in my Gemfile:</p>
  
  <pre><code>#Gemfile
  gem 'bootstrap-sass'
  gem 'autoprefixer-rails'
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>#app/assets/stylesheets/application.css.scss
  @import "bootstrap-sprockets";
  @import "bootstrap";
  /*
   *= require_tree .
   *= require_self
   */
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>#app/assets/javascripts/application.js
  //= require jquery
  //= require jquery_ujs
  //= require turbolinks
  //= require bootstrap-sprockets
  //= require_tree .
  </code></pre>
  
  <p>View displaying records:</p>
  
  <pre><code>#app/views/index.html.erb
  &lt;h4&gt;Listing Users&lt;/h4&gt;
  
  &lt;table class=" table table-striped" data-sort-name="name" data-sort-order="desc"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th data-field="name" data-sortable="true"&gt;Name&lt;/th&gt;
        &lt;th data-field="age" data-sortable="true"&gt;Age&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
  
    &lt;tbody&gt;
      &lt;% @users.each do |user| %&gt;
        &lt;tr&gt;
          &lt;td&gt;&lt;%= user.name %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= user.age %&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;br&gt;
  
  &lt;%= link_to 'New User', new_user_path %&gt;
  </code></pre>