Issues using Table Sorter with Ruby on Rails
Hello, I have a huge issue with the table sorter plugin currently. For some reason, even though everything shows up fine, when I click on a header nothing is sorting itself out. I have seen other people successfully use table sorter with ruby on rails but I am having a strong issue with it.
Here is my index.html.erb
- <head>
- <script>
- $(document).ready(function()
- {
- $("#items").tablesorter();
- }
- );
- </script>
- </head>
- <body>
- <h1>All Items</h1>
- <table id="items" class="tablesorter tablesorter-blue">
- <thead>
- <tr>
- <td class="header">Item Name</td>
- <td class="header">Category</td>
- <td class="header">Item Description</td>
- <td class="header">Cost to Acquire</td>
- <td class="header">Auction Bought At</td>
- <td class="header">Auction Date</td>
- </tr>
- </thead>
- <tbody>
- <% @items.each do |item| %>
- <tr>
- <td><%= item.itemName %></td>
- <td><%= item.category %></td>
- <td><%= item.itemDesc %></td>
- <td><%= item.costToAcquire %></td>
- <td><%= item.auctionBoughtAt %></td>
- <td><%= item.auctionDate %></td>
- <td><%= link_to "Delete",item_path(item), method: :delete,data: { confirm: 'Are you sure?' } %></td>
- <td><%= link_to "Edit", edit_item_path(item) %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
- <%= link_to "Add an Item", new_item_path, class: "new_item" %>
-
- </body>
Here is my Gemfile
- source 'https://rubygems.org'
- gem 'jquery-tablesorter'
- gem 'jquery-turbolinks'
- # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
- gem 'rails', '4.0.4'
- # Use sqlite3 as the database for Active Record
- gem 'sqlite3'
- # Use SCSS for stylesheets
- gem 'sass-rails', '~> 4.0.2'
- # Use Uglifier as compressor for JavaScript assets
- gem 'uglifier', '>= 1.3.0'
- # Use CoffeeScript for .js.coffee assets and views
- gem 'coffee-rails', '~> 4.0.0'
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
- # gem 'therubyracer', platforms: :ruby
- # Use jquery as the JavaScript library
- gem 'jquery-rails'
- # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
- gem 'turbolinks'
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
- gem 'jbuilder', '~> 1.2'
- group :doc do
- # bundle exec rake doc:rails generates the API under doc/api.
- gem 'sdoc', require: false
- end
- # Use ActiveModel has_secure_password
- # gem 'bcrypt', '~> 3.1.7'
- # Use unicorn as the app server
- # gem 'unicorn'
- # Use Capistrano for deployment
- # gem 'capistrano', group: :development
- # Use debugger
- # gem 'debugger', group: [:development, :test]
And here is my application.html.erb
- <!DOCTYPE html>
- <html>
- <head>
- <title>Debsmiscriver</title>
- <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
- <%= javascript_include_tag params[:controller], "data-turbolinks-track" => true %>
- <%= csrf_meta_tags %>
- </head>
- <body>
- <%= yield %>
- </body>
- </html>
Any help would be seriously appreciated!