Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to 2.7.5 #7

Merged
merged 4 commits into from
Feb 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog
===
#### v1.4.1

* Upgrade tablesorter to v2.7.5

#### v1.4.0

* Upgrade tablesorter to v2.7.3
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Simple integration of jquery-tablesorter into the asset pipeline.

Current tablesorter version: 2.7.3 (1/10/2013), [documentation]
Current tablesorter version: 2.7.5 (2/5/2013), [documentation]

Any issue associate with the js/css files, please report to [Mottie's fork].

Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace :jquery_tablesorter do
#
javascript_dir = 'vendor/assets/javascripts/jquery-tablesorter'
FileUtils.mkdir_p(javascript_dir)
Dir.glob('tablesorter/js/*.js').each do |file|
Dir.glob('tablesorter/js/*.js').reject{ |file| file =~ /.min.js\Z/}.each do |file|
FileUtils.cp file, javascript_dir, :verbose => true
end

Expand Down
2 changes: 1 addition & 1 deletion lib/jquery-tablesorter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module JqueryTablesorter
VERSION = "1.4.0"
VERSION = "1.4.1"
end
2 changes: 1 addition & 1 deletion tablesorter
Submodule tablesorter updated 75 files
+28 −1 README.md
+10 −6 addons/pager/jquery.tablesorter.pager.js
+2 −2 addons/pager/jquery.tablesorter.pager.min.js
+7 −0 component.json
+4 −3 docs/css/jq.css
+55 −0 docs/css/prettify.css
+4 −4 docs/example-add-rows.html
+6 −6 docs/example-ajax.html
+4 −4 docs/example-apply-widget.html
+4 −4 docs/example-child-rows-filtered.html
+4 −4 docs/example-child-rows.html
+4 −4 docs/example-empty-table.html
+4 −4 docs/example-extending-defaults.html
+4 −4 docs/example-header-column-span.html
+4 −4 docs/example-locale-sort.html
+4 −4 docs/example-meta-headers.html
+4 −4 docs/example-meta-parsers.html
+4 −4 docs/example-meta-sort-list.html
+3 −3 docs/example-method-sortreset.html
+4 −4 docs/example-multiple-tbodies.html
+4 −4 docs/example-option-custom-sort.html
+4 −4 docs/example-option-date-format.html
+4 −4 docs/example-option-debug.html
+4 −4 docs/example-option-digits.html
+6 −6 docs/example-option-render-header.html
+5 −5 docs/example-option-render-template.html
+4 −4 docs/example-option-selectorsort.html
+3 −3 docs/example-option-show-processing.html
+4 −4 docs/example-option-sort-append.html
+4 −4 docs/example-option-sort-empty.html
+4 −5 docs/example-option-sort-force.html
+4 −4 docs/example-option-sort-key.html
+4 −4 docs/example-option-sort-list.html
+4 −4 docs/example-option-sort-order.html
+4 −4 docs/example-option-sortreset-sortrestart.html
+4 −4 docs/example-option-text-extraction.html
+4 −4 docs/example-options-headers-digits-strings.html
+4 −4 docs/example-options-headers-locked.html
+4 −4 docs/example-options-headers-order.html
+4 −4 docs/example-options-headers.html
+7 −7 docs/example-pager-ajax.html
+18 −7 docs/example-pager-filtered.html
+24 −14 docs/example-pager.html
+4 −4 docs/example-parsers-advanced.html
+4 −4 docs/example-parsers-class-name.html
+4 −4 docs/example-parsers-jquery-data.html
+4 −4 docs/example-parsers.html
+4 −4 docs/example-trigger-sort.html
+3 −3 docs/example-triggers.html
+4 −4 docs/example-update-cell.html
+4 −4 docs/example-widget-bootstrap-theme.html
+12 −9 docs/example-widget-columns.html
+4 −8 docs/example-widget-filter-custom.html
+8 −115 docs/example-widget-filter.html
+96 −12 docs/example-widget-resizable.html
+5 −5 docs/example-widget-savesort.html
+3 −3 docs/example-widget-sticky-header.html
+13 −10 docs/example-widget-ui-theme.html
+6 −7 docs/example-widget-zebra.html
+5 −7 docs/example-widgets.html
+163 −139 docs/index.html
+3 −18 docs/js/docs.js
+28 −0 docs/js/prettify.js
+34 −36 docs/themes.html
+1 −1 index.html
+33 −18 js/jquery.tablesorter.js
+2 −2 js/jquery.tablesorter.min.js
+46 −28 js/jquery.tablesorter.widgets.js
+9 −8 js/jquery.tablesorter.widgets.min.js
+40 −40 package.json
+42 −0 tablesorter.jquery.json
+5 −5 test.html
+0 −0 testing/jshint-r12.js
+1 −1 testing/qunit-1.11.0.css
+150 −80 testing/qunit-1.11.0.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* tablesorter pager plugin
* updated 1/4/2013
* updated 1/29/2013
*/
/*jshint browser:true, jquery:true, unused:false */
;(function($) {
Expand Down Expand Up @@ -138,7 +138,7 @@
if (h) {
d = h - $b.height();
if ( d > 5 && $.data(table, 'pagerLastSize') === c.size && $b.children('tr:visible').length < c.size ) {
$b.append('<tr class="pagerSavedHeightSpacer ' + table.config.selectorRemove.replace('.','') + '" style="height:' + d + 'px;"></tr>');
$b.append('<tr class="pagerSavedHeightSpacer ' + table.config.selectorRemove.replace(/(tr)?\./g,'') + '" style="height:' + d + 'px;"></tr>');
}
}
}
Expand Down Expand Up @@ -188,9 +188,8 @@
var i, j, hsh, $f, $sh,
$t = $(table),
tc = table.config,
$b = c.$tbodies,
hl = $t.find('thead th').length, tds = '',
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove.replace('.','') + '"><td style="text-align: center;" colspan="' + hl + '">' +
err = '<tr class="' + c.cssErrorRow + ' ' + tc.selectorRemove.replace(/(tr)?\./g,'') + '"><td style="text-align: center;" colspan="' + hl + '">' +
(exception ? exception.message + ' (' + exception.name + ')' : 'No rows found') + '</td></tr>',
result = c.ajaxProcessing(data) || [ 0, [] ],
d = result[1] || [],
Expand Down Expand Up @@ -234,7 +233,7 @@
// add error row to thead instead of tbody, or clicking on the header will result in a parser error
$t.find('thead').append(err);
} else {
$b.html( tds ); // add tbody
$(table.tBodies[0]).html( tds ); // add rows to first tbody
}
if (tc.showProcessing) {
$.tablesorter.isProcessing(table); // remove loading icon
Expand Down Expand Up @@ -453,7 +452,7 @@
config.appender = $this.appender;

$t
.unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager')
.unbind('filterStart.pager filterEnd.pager sortEnd.pager disable.pager enable.pager destroy.pager update.pager pageSize.pager')
.bind('filterStart.pager', function(e, filters) {
$.data(table, 'pagerUpdateTriggered', false);
c.currentFilters = filters;
Expand Down Expand Up @@ -481,6 +480,11 @@
})
.bind('update.pager', function(){
hideRows(table, c);
})
.bind('pageSize.pager', function(e,v){
c.size = parseInt(v, 10) || 10;
hideRows(table, c);
updatePageDisplay(table, c);
});

// clicked controls
Expand Down
51 changes: 33 additions & 18 deletions vendor/assets/javascripts/jquery-tablesorter/jquery.tablesorter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* TableSorter 2.7.3 - Client-side table sorting with ease!
* TableSorter 2.7.5 - Client-side table sorting with ease!
* @requires jQuery v1.2.6+
*
* Copyright (c) 2007 Christian Bach
Expand All @@ -24,7 +24,7 @@

var ts = this;

ts.version = "2.7.3";
ts.version = "2.7.5";

ts.parsers = [];
ts.widgets = [];
Expand Down Expand Up @@ -160,7 +160,7 @@
}
}
for (i = 1; i < l; i++) {
if (ts.parsers[i].is(nodeValue, table, node)) {
if (ts.parsers[i].is && ts.parsers[i].is(nodeValue, table, node)) {
return ts.parsers[i];
}
}
Expand All @@ -170,7 +170,8 @@

function buildParserCache(table) {
var c = table.config,
tb = c.$tbodies,
// update table bodies in case we start with an empty table
tb = c.$tbodies = c.$table.children('tbody:not(.' + c.cssInfoBlock + ')'),
rows, list, l, i, h, ch, p, parsersDebug = "";
if ( tb.length === 0) {
return c.debug ? log('*Empty table!* Not building a parser cache') : '';
Expand Down Expand Up @@ -322,6 +323,7 @@
function computeThIndexes(t) {
var matrix = [],
lookup = {},
cols = 0, // determine the number of columns
trs = $(t).find('thead:eq(0), tfoot').children('tr'), // children tr in tfoot - see issue #196
i, j, k, l, c, cells, rowIndex, cellId, rowSpan, colSpan, firstAvailCol, matrixrow;
for (i = 0; i < trs.length; i++) {
Expand All @@ -343,6 +345,7 @@
}
}
lookup[cellId] = firstAvailCol;
cols = Math.max(firstAvailCol, cols);
// add data-column
$(c).attr({ 'data-column' : firstAvailCol }); // 'data-row' : rowIndex
for (k = rowIndex; k < rowIndex + rowSpan; k++) {
Expand All @@ -356,6 +359,7 @@
}
}
}
t.config.columns = cols; // may not be accurate if # header columns !== # tbody columns
return lookup;
}

Expand Down Expand Up @@ -443,14 +447,25 @@
}
}

// automatically add col group, and column sizes if set
function fixColumnWidth(table) {
if (table.config.widthFixed && $(table).find('colgroup').length === 0) {
var colgroup = $('<colgroup>'),
overallWidth = $(table).width();
$("tr:first td", table.tBodies[0]).each(function() {
colgroup.append($('<col>').css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%'));
});
$(table).prepend(colgroup);
var $c, c = table.config,
$cg = $('<colgroup>'),
$cgo = c.$table.find('colgroup'),
n = c.columns.length,
overallWidth = c.$table.width();
$("tr:first td", table.tBodies[0]).each(function(i) {
$c = $('<col>');
if (c.widthFixed) {
$c.css('width', parseInt(($(this).width()/overallWidth)*1000, 10)/10 + '%');
}
$cg.append($c);
});
// replace colgroup contents
if ($cgo.length) {
$cgo.html( $cg.html() );
} else {
c.$table.prepend( $cg );
}
}

Expand Down Expand Up @@ -564,6 +579,9 @@
c.$tbodies = $this.children('tbody:not(.' + c.cssInfoBlock + ')');
// build headers
c.$headers = buildHeaders($t0);
// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
fixColumnWidth($t0);
// try to auto detect column type, and store in tables config
c.parsers = buildParserCache($t0);
// build the cache for the tbody cells
Expand Down Expand Up @@ -703,7 +721,7 @@
multisort($t0);
appendToTable($t0);
})
.bind("update", function(e, resort, callback) {
.bind("update updateRows", function(e, resort, callback) {
// remove rows/elements before update
$(c.selectorRemove, $t0).remove();
// rebuild parsers
Expand Down Expand Up @@ -805,10 +823,6 @@
ts.applyWidget($t0);
}

// fixate columns if the users supplies the fixedWidth option
// do this after theme has been applied
fixColumnWidth($t0);

// show processesing icon
if (c.showProcessing) {
$this
Expand Down Expand Up @@ -1238,7 +1252,7 @@
ts.addParser({
id: "isoDate",
is: function(s) {
return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s);
return (/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}/).test(s);
},
format: function(s, table) {
return ts.formatFloat((s !== "") ? (new Date(s.replace(/-/g, "/")).getTime() || "") : "", table);
Expand All @@ -1261,7 +1275,8 @@
id: "usLongDate",
is: function(s) {
// two digit years are not allowed cross-browser
return (/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i).test(s);
// Jan 01, 2013 12:34:56 PM or 01 Jan 2013
return (/^[A-Z]{3,10}\.?\s+\d{1,2},?\s+(\d{4})(\s+\d{1,2}:\d{2}(:\d{2})?(\s+[AP]M)?)?$/i).test(s) || (/^\d{1,2}\s+[A-Z]{3,10}\s+\d{4}/i).test(s);
},
format: function(s, table) {
return ts.formatFloat( (new Date(s.replace(/(\S)([AP]M)$/i, "$1 $2")).getTime() || ''), table);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! tableSorter 2.4+ widgets - updated 1/10/2013
/*! tableSorter 2.4+ widgets - updated 1/29/2013
*
* Column Styles
* Column Filters
Expand Down Expand Up @@ -810,14 +810,24 @@ $.tablesorter.addWidget({
format: function(table){
if ($(table).hasClass('hasResizable')) { return; }
$(table).addClass('hasResizable');
var t, j, s, $c, $cols,
var $t, t, i, j, s, $c, $cols, w, tw,
$tbl = $(table),
c = table.config,
wo = c.widgetOptions,
position = 0,
$target = null,
$next = null,
fullWidth = Math.abs($tbl.parent().width() - $tbl.width()) < 20,
stopResize = function(){
if ($.tablesorter.storage && $target){
s[$target.index()] = $target.width();
s[$next.index()] = $next.width();
$target.width( s[$target.index()] );
$next.width( s[$next.index()] );
if (wo.resizable !== false){
$.tablesorter.storage(table, 'tablesorter-resizable', s);
}
}
position = 0;
$target = $next = null;
$(window).trigger('resize'); // will update stickyHeaders, just in case
Expand All @@ -831,8 +841,17 @@ $.tablesorter.addWidget({
}
}
}
$tbl.children('thead:first').find('tr').each(function(){
$c = $(this).children();
$t = $tbl.children('thead:first').children('tr');
// add resizable-false class name to headers (across rows as needed)
$t.children().each(function(){
t = $(this);
i = t.attr('data-column');
j = $.tablesorter.getData( t, c.headers[i], 'resizable') === "false";
$t.children().filter('[data-column="' + i + '"]').toggleClass('resizable-false', j);
});
// add wrapper inside each cell to allow for positioning of the resizable target block
$t.each(function(){
$c = $(this).children(':not(.resizable-false)');
if (!$(this).find('.tablesorter-wrapper').length) {
// Firefox needs this inner div to position the resizer correctly
$c.wrapInner('<div class="tablesorter-wrapper" style="position:relative;height:100%;width:100%"></div>');
Expand All @@ -842,36 +861,37 @@ $.tablesorter.addWidget({
});
$cols
.each(function(){
t = $(this);
j = parseInt(t.css('padding-right'), 10) + 8; // 8 is 1/2 of the 16px wide resizer
t
$t = $(this);
j = parseInt($t.css('padding-right'), 10) + 10; // 8 is 1/2 of the 16px wide resizer grip
t = '<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;z-index:1;right:-' + j +
'px;top:0;height:100%;width:20px;"></div>';
$t
.find('.tablesorter-wrapper')
.append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:16px;right:-' + j + 'px;top:0;z-index:1;"></div>');
.append(t);
})
.bind('mousemove.tsresize', function(e){
// ignore mousemove if no mousedown
if (position === 0 || !$target) { return; }
// resize columns
var w = e.pageX - position;
$target.width( $target.width() + w );
$next.width( $next.width() - w );
w = e.pageX - position;
tw = $target.width();
$target.width( tw + w );
if ($target.width() !== tw && fullWidth){
$next.width( $next.width() - w );
}
position = e.pageX;
})
.bind('mouseup.tsresize', function(){
if ($.tablesorter.storage && $target){
s[$target.index()] = $target.width();
s[$next.index()] = $next.width();
if (wo.resizable !== false){
$.tablesorter.storage(table, 'tablesorter-resizable', s);
}
}
stopResize();
})
.find('.tablesorter-resizer')
.find('.tablesorter-resizer,.tablesorter-resizer-grip')
.bind('mousedown', function(e){
// save header cell and mouse position; closest() not supported by jQuery v1.2.6
$target = $(e.target).parents('th:last');
$next = $target.next();
$target = $(e.target).closest('th');
t = c.$headers.filter('[data-column="' + $target.attr('data-column') + '"]');
if (t.length > 1) { $target = $target.add(t); }
// if table is not as wide as it's parent, then resize the table
$next = e.shiftKey ? $target.parent().find('th:not(.resizable-false)').filter(':last') : $target.nextAll(':not(.resizable-false)').eq(0);
position = e.pageX;
});
$tbl.find('thead:first')
Expand All @@ -894,16 +914,14 @@ $.tablesorter.addWidget({
.unbind('mouseup.tsresize mouseleave.tsresize contextmenu.tsresize')
.find('tr').children()
.unbind('mousemove.tsresize mouseup.tsresize')
.find('.tablesorter-wrapper').each(function(){
$(this).find('.tablesorter-resizer').remove();
$(this).replaceWith( $(this).contents() );
});
// don't remove "tablesorter-wrapper" as uitheme uses it too
.find('.tablesorter-resizer,.tablesorter-resizer-grip').remove();
$.tablesorter.resizableReset(table);
}
});
$.tablesorter.resizableReset = function(table){
$(table.config.headerList).width('auto');
$.tablesorter.storage(table, 'tablesorter-resizable', {});
$(table.config.headerList).filter(':not(.resizable-false)').css('width','');
if ($.tablesorter.storage) { $.tablesorter.storage(table, 'tablesorter-resizable', {}); }
};

// Save table sort widget
Expand Down Expand Up @@ -956,7 +974,7 @@ $.tablesorter.addWidget({
},
remove: function(table, c, wo){
// clear storage
$.tablesorter.storage( table, 'tablesorter-savesort', '' );
if ($.tablesorter.storage) { $.tablesorter.storage( table, 'tablesorter-savesort', '' ); }
}
});

Expand Down
Loading