Why is jquery-tablesorter not working in my Rails 4 app? -


i'm trying add jquery-tablesorter functionality new app built off of michael hartl's rails tutorial sample app, using ruby 2.1.0p0 , rails 4.0.2 on mac (osx mavericks), , i'm sure i'm doing wrong, since demo code works in browser.

following these instructions, added following line gemfile:

gem 'jquery-tablesorter' 

and ran

'bundle install' 

here's a gist of new contents of gemfile.lock.

i added application.js file:

//= require jquery-tablesorter 

and application.css file:

*= require jquery-tablesorter/theme.blue 

copied these files app/assets/javascripts folder (although believe need "jquery.tablesorter.js"):

jquery.metadata.js jquery.tablesorter.js jquery.tablesorter.widgets.js 

then followed these instructions, making table have id of "mytable" , class of "tablesorter" , placing code "studios.js" file:

$(function(){     $("#mytable").tablesorter(); }); 

but when view studios/index, no sortable headers, , no blue-themed styling. javascript , css files loaded successfully, according development log.

here's a gist of page source.

the rails tutorial code included microposts.js file displaying running count of available characters remaining in new micropost:

function updatecountdown() {         // 140 max message length         var remainder = 140 - jquery('#micropost_content').val().length;         jquery('.countdown').text(remainder + ' characters remaining'); }  jquery(document).ready(function($) {         updatecountdown();         $('#micropost_content').change(updatecountdown);         $('#micropost_content').keyup(updatecountdown); }); 

i thought, since javascript uses 'jquery(document).ready(function($)' rather '$(document).ready(function()),' shown in getting started instructions tablesorter, , since microposts.js code functions correctly, should try changing studios.js this:

jquery(document).ready(function($){     $("#mytable").tablesorter(); }); 

but alas, i'm still not getting sortable headers or blue-themed styling.

the instructions @ https://github.com/themilkman/jquery-tablesorter-rails don't mention whether image assets need added, nor whether css files need stored/edited. perusing theme.blue.css file loaded in page's source, can see arrow images encoded, believe shouldn't need them in app/assets/images folder.
, since can view theme.blue.css file clicking link when viewing page's source, assume blue-themed styling being loaded, too.

i think i've got pieces in place tablesorter function, can't figure out why none of table's elements being updated tablesorter classes, , therefore none of sorting functionality , styling being applied.

i created demo how add tablesorter gem plain rails project (especially second commit adds important stuff): https://github.com/themilkman/tablesorter-demo regarding issues: 1. should not copy default js/css files, come gem , in rails asset pipeline automatically. 2. sounds turbo-links troubles. added gem against in example above. hope helps!


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -