Sha256: 88001397d581eea04a1f6df311197a56d80b7f3b754addf1ac2f5e52995b19eb

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

$(document).ready(function(){
  if(!sortPlease) return;
  $.tablesorter.addWidget({
    id: "columnHighlight",
    format: function(table) {
      if (!this.tds)
        this.tds =  $("td", table.tBodies[0]);
      if (!this.headers)
        this.headers = $("thead th", table);
      this.tds.removeClass("sorted");
      var ascSort = $("th." + table.config.cssAsc);
      var descSort = $("th." + table.config.cssDesc);
      if (ascSort.length)
        index = this.headers.index(ascSort[0]);
      if (descSort.length)
        index = this.headers.index(descSort[0]);
      $("tr td:nth-child(" + (index+1) + ")", table.tBodies[0]).each(function(row){
        $(this).addClass('sorted');
      });
    }
  }); 

  //initialize the table
  var table = window.table = $('#data').tablesorter({
    widgets: ['columnHighlight'],
    sortList: sortOrder//,
    //debug: true
  })
  .tablesorterPager({container: $("#pager"), positionFixed: false, size: perPage})
  .tablesorterMultiPageFilter({filterSelector: $("#filter input")});

});

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
table_setter_generator-0.1.0 templates/ts/public/javascripts/application.js
table_setter-0.1.3 template/public/javascripts/application.js
table_setter-0.1.2 template/public/javascripts/application.js