mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
default css names & widget fixes
This commit is contained in:
parent
0642f8e625
commit
ac26e9415d
@ -34,6 +34,23 @@ Included all original [document pages](http://mottie.github.com/tablesorter/docs
|
||||
|
||||
View the [complete listing here](http://mottie.github.com/tablesorter/changelog.txt).
|
||||
|
||||
#### Version 2.1.7 (3/26/2012)
|
||||
|
||||
* Changed default css options to use more unique names:
|
||||
* `cssHeader` is now `"tablesorter-header"`
|
||||
* `cssAsc` is now `"tablesorter-headerSortUp"`
|
||||
* `cssDesc` is now `"tablesorter-headerSortDown"`
|
||||
* Updated blue & green styles to use the appropriate names.
|
||||
* Left the original css definitions to keep the styles backward compatible.
|
||||
* Table header cell content wrapper modification:
|
||||
* Previously the content was wrapped with a `span`, now wrapped with a `div`
|
||||
* Content wrapping div now as the class name of `tablesorter-header-inner` applied to it.
|
||||
* Various widget fixes:
|
||||
* The `$.tablesorter.storage` code now loads saved variables before updating. Fix for [issue #41](https://github.com/Mottie/tablesorter/issues/41).
|
||||
* Reverted the "filter" widget code to work like it is supposed to. Fix for [issue #40](https://github.com/Mottie/tablesorter/issues/40).
|
||||
* Modified the "stickHeaders" widget to now set the width of the content instead of the table cell. It seems to work better. Fix for [issue #37](https://github.com/Mottie/tablesorter/issues/37)
|
||||
* Fixed the "uitheme" widget code to update the sorting icon correctly.
|
||||
|
||||
#### Version 2.1.6 (3/22/2012)
|
||||
|
||||
* Pager updates
|
||||
|
@ -1,5 +1,23 @@
|
||||
TableSorter Change Log
|
||||
|
||||
Version 2.1.7 (3/26/2012)
|
||||
============================
|
||||
|
||||
* Changed default css options to use more unique names:
|
||||
* `cssHeader` is now `"tablesorter-header"`
|
||||
* `cssAsc` is now `"tablesorter-headerSortUp"`
|
||||
* `cssDesc` is now `"tablesorter-headerSortDown"`
|
||||
* Updated blue & green styles to use the appropriate names.
|
||||
* Left the original css definitions to keep the styles backward compatible.
|
||||
* Table header cell content wrapper modification:
|
||||
* Previously the content was wrapped with a `span`, now wrapped with a `div`
|
||||
* Content wrapping div now as the class name of `tablesorter-header-inner` applied to it.
|
||||
* Various widget fixes:
|
||||
* The `$.tablesorter.storage` code now loads saved variables before updating. Fix for [issue #41](https://github.com/Mottie/tablesorter/issues/41).
|
||||
* Reverted the "filter" widget code to work like it is supposed to. Fix for [issue #40](https://github.com/Mottie/tablesorter/issues/40).
|
||||
* Modified the "stickHeaders" widget to now set the width of the content instead of the table cell. It seems to work better. Fix for [issue #37](https://github.com/Mottie/tablesorter/issues/37)
|
||||
* Fixed the "uitheme" widget code to update the sorting icon correctly.
|
||||
|
||||
Version 2.1.6 (3/22/2012)
|
||||
============================
|
||||
|
||||
|
Binary file not shown.
@ -8,17 +8,23 @@ table.tablesorter {
|
||||
text-align: left;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table.tablesorter, table.tablesorter th, table.tablesorter tr.tablesorter-stickyHeader th, table.tablesorter td {
|
||||
table.tablesorter,
|
||||
table.tablesorter th,
|
||||
table.tablesorter tr.tablesorter-stickyHeader th,
|
||||
table.tablesorter td {
|
||||
border: #cdcdcd 1px solid;
|
||||
}
|
||||
|
||||
table.tablesorter thead tr th, tr.tablesorter-stickyHeader th, table.tablesorter tfoot tr th {
|
||||
table.tablesorter thead tr th,
|
||||
tr.tablesorter-stickyHeader th,
|
||||
table.tablesorter tfoot tr th {
|
||||
background-color: #e6eeee;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
padding: 4px 20px 4px 4px;
|
||||
}
|
||||
table.tablesorter thead tr .header, tr.tablesorter-stickyHeader .header {
|
||||
table.tablesorter thead tr .tablesorter-header,
|
||||
tr.tablesorter-stickyHeader .tablesorter-header {
|
||||
background-image: url(black-bg.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center right;
|
||||
@ -30,11 +36,13 @@ table.tablesorter tbody td {
|
||||
background-color: #fff;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.tablesorter thead tr .headerSortUp {
|
||||
table.tablesorter thead tr .headerSortUp,
|
||||
table.tablesorter thead tr .tablesorter-headerSortUp {
|
||||
background-color: #8dbdd8;
|
||||
background-image: url(black-asc.gif);
|
||||
}
|
||||
table.tablesorter thead tr .headerSortDown {
|
||||
table.tablesorter thead tr .headerSortDown,
|
||||
table.tablesorter thead tr .tablesorter-headerSortDown {
|
||||
background-color: #8dbdd8;
|
||||
background-image: url(black-desc.gif);
|
||||
}
|
||||
|
Binary file not shown.
@ -8,11 +8,16 @@ table.tablesorter {
|
||||
text-align: left;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table.tablesorter, table.tablesorter th, table.tablesorter tr.tablesorter-stickyHeader th, table.tablesorter td {
|
||||
table.tablesorter,
|
||||
table.tablesorter th,
|
||||
table.tablesorter tr.tablesorter-stickyHeader th,
|
||||
table.tablesorter td {
|
||||
border: #cdcdcd 1px solid;
|
||||
}
|
||||
|
||||
table.tablesorter thead tr th, tr.tablesorter-stickyHeader th, table.tablesorter tfoot tr th {
|
||||
table.tablesorter thead tr th,
|
||||
tr.tablesorter-stickyHeader th,
|
||||
table.tablesorter tfoot tr th {
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
padding: 5px;
|
||||
@ -21,24 +26,32 @@ table.tablesorter td {
|
||||
color: #3d3d3d;
|
||||
padding: 5px;
|
||||
}
|
||||
table.tablesorter thead tr, table.tablesorter tfoot tr {
|
||||
table.tablesorter thead tr.tablesorter-header,
|
||||
table.tablesorter thead tr.tablesorter-stickyHeader,
|
||||
table.tablesorter tfoot tr {
|
||||
background: url(bkgd.png) center center repeat-x;
|
||||
}
|
||||
table.tablesorter .header {
|
||||
table.tablesorter .header,
|
||||
table.tablesorter .tablesorter-header {
|
||||
background: transparent;
|
||||
border-right: #cdcdcd 1px solid;
|
||||
padding: 9px;
|
||||
height: auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
table.tablesorter .header span:first-child, .tablesorter-stickyHeader .header span:first-child {
|
||||
table.tablesorter .header span:first-child,
|
||||
.tablesorter-stickyHeader .header span:first-child,
|
||||
table.tablesorter th.tablesorter-header .tablesorter-header-inner,
|
||||
.tablesorter-stickyHeader th.tablesorter-header .tablesorter-header-inner {
|
||||
background: url(none.png) no-repeat;
|
||||
padding: 2px 0 2px 25px;
|
||||
}
|
||||
table.tablesorter .headerSortUp span:first-child {
|
||||
table.tablesorter .headerSortUp span:first-child,
|
||||
table.tablesorter .tablesorter-headerSortUp .tablesorter-header-inner {
|
||||
background: url(asc.png) no-repeat;
|
||||
}
|
||||
table.tablesorter .headerSortDown span:first-child {
|
||||
table.tablesorter .headerSortDown span:first-child,
|
||||
table.tablesorter .tablesorter-headerSortDown .tablesorter-header-inner {
|
||||
background: url(desc.png) no-repeat;
|
||||
}
|
||||
|
||||
@ -51,21 +64,24 @@ table.tablesorter tr.even td {
|
||||
}
|
||||
|
||||
/* Column Widget - column sort colors */
|
||||
table.tablesorter tbody td.primary, table.tablesorter tbody tr.odd td.primary {
|
||||
table.tablesorter tbody td.primary,
|
||||
table.tablesorter tbody tr.odd td.primary {
|
||||
background-color: #c0ffc0;
|
||||
}
|
||||
table.tablesorter tbody tr.even td.primary {
|
||||
background-color: #e8ffe8;
|
||||
}
|
||||
|
||||
table.tablesorter tbody td.secondary, table.tablesorter tbody tr.odd td.secondary {
|
||||
table.tablesorter tbody td.secondary,
|
||||
table.tablesorter tbody tr.odd td.secondary {
|
||||
background-color: #d6ffd6;
|
||||
}
|
||||
table.tablesorter tbody tr.even td.secondary {
|
||||
background-color: #e8ffe8;
|
||||
}
|
||||
|
||||
table.tablesorter tbody td.tertiary, table.tablesorter tbody tr.odd td.tertiary {
|
||||
table.tablesorter tbody td.tertiary,
|
||||
table.tablesorter tbody tr.odd td.tertiary {
|
||||
background-color: #eaffea;
|
||||
}
|
||||
table.tablesorter tbody tr.even td.tertiary {
|
||||
@ -79,7 +95,8 @@ table.tablesorter thead tr.tablesorter-filter input.tablesorter-filter {
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
table.tablesorter thead tr.tablesorter-filter, table.tablesorter thead tr.tablesorter-filter td {
|
||||
table.tablesorter thead tr.tablesorter-filter,
|
||||
table.tablesorter thead tr.tablesorter-filter td {
|
||||
text-align: center;
|
||||
background: #fff;
|
||||
}
|
||||
|
@ -7,7 +7,8 @@ table.tablesorter {
|
||||
text-align: left;
|
||||
padding: 5px;
|
||||
}
|
||||
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
|
||||
table.tablesorter thead tr th,
|
||||
table.tablesorter tfoot tr th {
|
||||
border-collapse: collapse;
|
||||
font-size: 8pt;
|
||||
padding: 4px;
|
||||
@ -47,7 +48,8 @@ table.tablesorter thead tr.tablesorter-filter input.tablesorter-filter {
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
table.tablesorter thead tr.tablesorter-filter, table.tablesorter thead tr.tablesorter-filter td {
|
||||
table.tablesorter thead tr.tablesorter-filter,
|
||||
table.tablesorter thead tr.tablesorter-filter td {
|
||||
text-align: center;
|
||||
}
|
||||
/* optional disabled input styling */
|
||||
|
@ -27,7 +27,7 @@
|
||||
-moz-border-radius: 1em;
|
||||
-webkit-border-radius: 1em;
|
||||
}
|
||||
.headerSortDown .roundedCorners {
|
||||
.tablesorter-headerSortDown .roundedCorners {
|
||||
border-color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
@ -403,12 +403,12 @@
|
||||
<tr id="cssasc">
|
||||
<td><a href="#" class="toggle2">cssAsc</a></td>
|
||||
<td>String</td>
|
||||
<td>"headerSortUp"</td>
|
||||
<td>"tablesorter-headerSortUp"</td>
|
||||
<td>The CSS style used to style the header when sorting ascending. Example from the blue skin:
|
||||
<div class="collapsible">
|
||||
<pre class="css">th.headerSortUp {
|
||||
background-image: url(../img/small_asc.gif);
|
||||
background-color: #3399FF;
|
||||
<pre class="css">th.tablesorter-headerSortUp {
|
||||
background-color: #8dbdd8;
|
||||
background-image: url(black-asc.gif);
|
||||
}</pre></div>
|
||||
</td>
|
||||
<td></td>
|
||||
@ -472,12 +472,12 @@
|
||||
<tr id="cssdesc">
|
||||
<td><a href="#" class="toggle2">cssDesc</a></td>
|
||||
<td>String</td>
|
||||
<td>"headerSortDown"</td>
|
||||
<td>"tablesorter-headerSortDown"</td>
|
||||
<td>The CSS style used to style the header when sorting descending. Example from the blue skin:
|
||||
<div class="collapsible">
|
||||
<pre class="css">th.headerSortDown {
|
||||
background-image: url(../img/small_desc.gif);
|
||||
background-color: #3399FF;
|
||||
<pre class="css">th.tablesorter-headerSortDown {
|
||||
background-color: #8dbdd8;
|
||||
background-image: url(black-desc.gif);
|
||||
}</pre></div>
|
||||
</td>
|
||||
<td></td>
|
||||
@ -486,18 +486,18 @@
|
||||
<tr id="cssheader">
|
||||
<td><a href="#" class="toggle2">cssHeader</a></td>
|
||||
<td>String</td>
|
||||
<td>"header"</td>
|
||||
<td>"tablesorter-header"</td>
|
||||
<td>The CSS style used to style the header in its unsorted state. Example from the blue skin:
|
||||
<div class="collapsible">
|
||||
<pre class="css">th.header {
|
||||
background-image: url(../img/small.gif);
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
<pre class="css">th.tablesorter-header {
|
||||
background-color: #e6eeee;
|
||||
background-image: url(black-bg.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center left;
|
||||
padding-left: 20px;
|
||||
border-right: 1px solid #dad9c7;
|
||||
margin-left: -1px;
|
||||
background-position: center right;
|
||||
border-collapse: collapse;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
padding: 4px 20px 4px 4px;
|
||||
}</pre></div>
|
||||
</td>
|
||||
<td></td>
|
||||
@ -564,7 +564,7 @@
|
||||
<tr id="headerlist">
|
||||
<td>headerList</td>
|
||||
<td>Array</td>
|
||||
<td>[] (empty array)</td>
|
||||
<td>[ ] (empty array)</td>
|
||||
<td>Internal list of each header element as selected using jQuery selectors in the <a href="#selectorheaders"><code class="hilight">selectorHeaders</code></a> option. Not really useful for normal usage.</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
@ -647,7 +647,7 @@
|
||||
<tr id="parsers">
|
||||
<td><a href="#" class="toggle2">parsers</a></td>
|
||||
<td>Object</td>
|
||||
<td>{}</td>
|
||||
<td>{ }</td>
|
||||
<td>Internal list of all of the parsers. Here is a complete list of default parsers:
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
@ -865,7 +865,7 @@ $(function(){
|
||||
<tr id="widgets">
|
||||
<td>widgets</td>
|
||||
<td>Array</td>
|
||||
<td>[] (empty array)</td>
|
||||
<td>[ ] (empty array)</td>
|
||||
<td>
|
||||
Initialize widgets using this option ( e.g. <code class="hilight">widgets : ['zebra']</code>, or custom widgets <code class="hilight">widgets: ['zebra', 'myCustomWidget'];</code>, see <a href="example-widgets.html">this demo</a> on how to write your own custom widget ).
|
||||
</td>
|
||||
@ -886,7 +886,7 @@ $(function(){
|
||||
<tr id="widgetoptions">
|
||||
<td><a href="#" class="toggle2">widgetOptions</a></td>
|
||||
<td>Object</td>
|
||||
<td>{}</td>
|
||||
<td>{ }</td>
|
||||
<td>
|
||||
As of version 2.1, all widget options have been moved into this option. This is a move to store all widget specific options in one place so as not to polute the main table options. All current widgets have been modified to use this new option. <span class="tip"><em>New!</em></span> in v2.1.
|
||||
<div class="collapsible">
|
||||
@ -1485,7 +1485,7 @@ $(table)
|
||||
|
||||
<strong id="Download-Addons">Optional / Add-Ons:</strong>
|
||||
<ul>
|
||||
<li><a class="external" href="http://plugins.jquery.com/files/jquery.metadata.2.1.zip">jQuery Metadata 2.1</a> (3,7kb, required for setting <a href="#Examples">inline options</a>)</li>
|
||||
<li><a class="external" href="http://plugins.jquery.com/files/jquery.metadata.2.1.zip">jQuery Metadata 2.1</a> (6kb, required for setting <a href="#Examples">inline options</a>)</li>
|
||||
<li><a href="../js/jquery.tablesorter.js">jquery.tablesorter.js</a> (30kb/<a href="../js/jquery.tablesorter.min.js">17kb min</a>)</li>
|
||||
<li><a href="../addons/pager/jquery.tablesorter.pager.js">jquery.tablesorter.pager.js</a> (14kb/<a href="../addons/pager/jquery.tablesorter.pager.min.js">7kb min</a>, <a href="example-pager.html">demo</a>)</li>
|
||||
<li><a href="../js/jquery.tablesorter.widgets.js">jquery.tablesorter.widgets.js</a> (15kb/<a href="../js/jquery.tablesorter.widgets.min.js">7kb min</a>, includes the jQuery UI theme, columns styling, resizable columns, filter, sticky header and save sort widgets. <span class="tip"><em>Updated!</em></span> in v2.1.)</li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* TableSorter 2.1.6 - Client-side table sorting with ease!
|
||||
* TableSorter 2.1.7 - Client-side table sorting with ease!
|
||||
* @requires jQuery v1.2.6+
|
||||
*
|
||||
* Copyright (c) 2007 Christian Bach
|
||||
@ -18,13 +18,13 @@
|
||||
$.extend({
|
||||
tablesorter: new function(){
|
||||
|
||||
this.version = "2.1.6";
|
||||
this.version = "2.1.7";
|
||||
|
||||
var parsers = [], widgets = [], tbl;
|
||||
this.defaults = {
|
||||
cssHeader: "header",
|
||||
cssAsc: "headerSortUp",
|
||||
cssDesc: "headerSortDown",
|
||||
cssHeader: "tablesorter-header",
|
||||
cssAsc: "tablesorter-headerSortUp",
|
||||
cssDesc: "tablesorter-headerSortDown",
|
||||
cssChildRow: "expand-child",
|
||||
sortInitialOrder: "asc",
|
||||
sortMultiSortKey: "shiftKey",
|
||||
@ -347,12 +347,12 @@
|
||||
time = new Date();
|
||||
}
|
||||
$tableHeaders = $(c.selectorHeaders, table)
|
||||
.wrapInner("<span/>")
|
||||
.wrapInner("<div class='tablesorter-header-inner' />")
|
||||
.each(function (index) {
|
||||
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
|
||||
this.order = formatSortingOrder( checkHeaderOrder(table, index) ) ? [1,0,2] : [0,1,2];
|
||||
this.count = -1; // set to -1 because clicking on the header automatically adds one
|
||||
if (checkHeaderMetadata(this) || checkHeaderOptions(table, index) || $(this).is('.sorter-false')) { this.sortDisabled = true; }
|
||||
if (checkHeaderMetadata(this) || checkHeaderOptions(table, index) || $(this).hasClass('sorter-false')) { this.sortDisabled = true; }
|
||||
this.lockedOrder = false;
|
||||
lock = checkHeaderLocked(table, index);
|
||||
if (typeof(lock) !== 'undefined' && lock !== false) {
|
||||
@ -364,7 +364,7 @@
|
||||
}
|
||||
// add cell to headerList
|
||||
c.headerList[index] = this;
|
||||
$(this).parent().addClass('tablesorter-header');
|
||||
$(this).parent().addClass(c.cssHeader);
|
||||
});
|
||||
if (c.debug) {
|
||||
benchmark("Built headers", time);
|
||||
|
4
js/jquery.tablesorter.min.js
vendored
4
js/jquery.tablesorter.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
/*! tableSorter 2.1 widgets - updated 3/22/2012
|
||||
/*! tableSorter 2.1 widgets - updated 3/26/2012
|
||||
*
|
||||
* jQuery UI Theme
|
||||
* Column Styles
|
||||
@ -14,6 +14,9 @@
|
||||
/* IE7 needs JSON library for JSON.stringify - (http://caniuse.com/#search=json)
|
||||
if you need it, then include https://github.com/douglascrockford/JSON-js
|
||||
|
||||
$.parseJSON is not available is jQuery versions older than 1.4.1, using older
|
||||
versions will only allow storing information for one page at a time
|
||||
|
||||
// *** Save data (JSON format only) ***
|
||||
// val must be valid JSON... use http://jsonlint.com/ to ensure it is valid
|
||||
var val = { "mywidget" : "data1" }; // valid JSON uses double quotes
|
||||
@ -27,15 +30,26 @@
|
||||
alert(val); // "data1" if saved, or "" if not
|
||||
*/
|
||||
$.tablesorter.storage = function(table, key, val){
|
||||
var d, k, ls = false, v = {},
|
||||
var d, k, o = {}, ls = false, v = {},
|
||||
id = table.id || $('.tablesorter').index( $(table) ),
|
||||
url = window.location.pathname;
|
||||
try { ls = !!(localStorage.getItem); } catch(e) {}
|
||||
// *** get val ***
|
||||
if ($.parseJSON) {
|
||||
if (ls) {
|
||||
o = $.parseJSON(localStorage[key]) || {};
|
||||
} else {
|
||||
k = document.cookie.split(/[;\s|=]/); // cookie
|
||||
d = $.inArray(key, k) + 1; // add one to get from the key to the value
|
||||
o = (d !== 0) ? $.parseJSON(k[d]) || {} : {};
|
||||
}
|
||||
}
|
||||
if (val && JSON && JSON.hasOwnProperty('stringify')) {
|
||||
// add unique identifiers = url pathname > table ID/index on page > data
|
||||
v[url] = {};
|
||||
v[url][id] = {};
|
||||
v[url][id] = val;
|
||||
v = $.extend( o, v );
|
||||
// *** set val ***
|
||||
if (ls) {
|
||||
localStorage[key] = JSON.stringify(v);
|
||||
@ -44,17 +58,9 @@ $.tablesorter.storage = function(table, key, val){
|
||||
d.setTime(d.getTime()+(31536e+6)); // 365 days
|
||||
document.cookie = key + '=' + (JSON.stringify(v)).replace(/\"/g,'\"') + '; expires=' + d.toGMTString() + '; path=/';
|
||||
}
|
||||
} else if ($.parseJSON) {
|
||||
// *** get val ***
|
||||
if (ls) {
|
||||
v = $.parseJSON(localStorage[key]) || {};
|
||||
} else {
|
||||
k = document.cookie.split(/[;\s|=]/); // cookie
|
||||
d = $.inArray(key, k) + 1; // add one to get from the key to the value
|
||||
v = (d !== 0) ? $.parseJSON(k[d]) || {} : {};
|
||||
}
|
||||
} else {
|
||||
return ( o && o.hasOwnProperty(url) && o[url].hasOwnProperty(id) ) ? o[url][id] : {};
|
||||
}
|
||||
return ( v && v.hasOwnProperty(url) && v[url].hasOwnProperty(id)) ? v[url][id] : {};
|
||||
};
|
||||
|
||||
// Widget: jQuery UI theme
|
||||
@ -96,7 +102,7 @@ $.tablesorter.addWidget({
|
||||
$t.find('span.ui-icon').removeClass(rmv + ' ui-icon');
|
||||
} else {
|
||||
klass = ($t.hasClass(c.cssAsc)) ? icons[1] : ($t.hasClass(c.cssDesc)) ? icons[2] : $t.hasClass(c.cssHeader) ? icons[0] : '';
|
||||
t = ($table.hasClass('hasStickyHeaders')) ? $table.find('tr.' + wo.stickyHeaders || 'tablesorter-stickyheader').find('th').eq(i).add($t) : $t;
|
||||
t = ($table.hasClass('hasStickyHeaders')) ? $table.find('tr.' + (wo.stickyHeaders || 'tablesorter-stickyHeader')).find('th').eq(i).add($t) : $t;
|
||||
t[klass === icons[0] ? 'removeClass' : 'addClass']('ui-state-active')
|
||||
.find('span.ui-icon').removeClass(rmv).addClass(klass);
|
||||
}
|
||||
@ -190,7 +196,7 @@ $.tablesorter.addWidget({
|
||||
typeof wo.filter_childRows !== 'undefined' ? wo.filter_childRows : true)) ? cr.text() : '';
|
||||
$td = $(this).find('td');
|
||||
for (i=0; i < cols; i++){
|
||||
x = $.inArray( v[i], ($td.eq(i).text() + t).toLowerCase() );
|
||||
x = ($td.eq(i).text() + t).toLowerCase().indexOf(v[i]);
|
||||
if (v[i] !== '' && ( (!wo.filter_startsWith && x >= 0) || (wo.filter_startsWith && x === 0) ) ) {
|
||||
r = (r) ? true : false;
|
||||
} else if (v[i] !== '') {
|
||||
@ -223,14 +229,13 @@ $.tablesorter.addWidget({
|
||||
win = $(window),
|
||||
header = $(table).find('thead'),
|
||||
hdrCells = header.find('tr').children(),
|
||||
css = wo.stickyHeaders || 'tablesorter-stickyheader',
|
||||
css = wo.stickyHeaders || 'tablesorter-stickyHeader',
|
||||
firstCell = hdrCells.eq(0),
|
||||
brdr = parseInt(firstCell.css('border-left-width'),10),
|
||||
sticky = header.find('tr.tablesorter-header').clone()
|
||||
.removeClass('tablesorter-header')
|
||||
.addClass(css)
|
||||
.css({
|
||||
width : header.outerWidth() + brdr,
|
||||
width : header.outerWidth(true),
|
||||
position : 'fixed',
|
||||
left : firstCell.offset().left,
|
||||
margin : 0,
|
||||
@ -239,7 +244,7 @@ $.tablesorter.addWidget({
|
||||
zIndex : 10
|
||||
}),
|
||||
stkyCells = sticky.children(),
|
||||
laststate;
|
||||
laststate = '';
|
||||
// update sticky header class names to match real header after sorting
|
||||
$table.bind('sortEnd', function(e,t){
|
||||
var th = $(t).find('thead tr'),
|
||||
@ -254,8 +259,6 @@ $.tablesorter.addWidget({
|
||||
hdrCells.each(function(i){
|
||||
var t = $(this),
|
||||
s = stkyCells.eq(i)
|
||||
// set cell widths
|
||||
.width( t.width() + brdr )
|
||||
// clicking on sticky will trigger sort
|
||||
.bind('click', function(e){
|
||||
t.trigger(e);
|
||||
@ -264,7 +267,9 @@ $.tablesorter.addWidget({
|
||||
.bind('mousedown', function(){
|
||||
this.onselectstart = function(){ return false; };
|
||||
return false;
|
||||
});
|
||||
})
|
||||
// set cell widths
|
||||
.find('.tablesorter-header-inner').width( t.find('.tablesorter-header-inner').width() );
|
||||
});
|
||||
header.prepend( sticky );
|
||||
// make it sticky!
|
||||
@ -286,10 +291,10 @@ $.tablesorter.addWidget({
|
||||
.resize(function(){
|
||||
sticky.css({
|
||||
left : firstCell.offset().left - win.scrollLeft(),
|
||||
width: header.outerWidth() + brdr
|
||||
width: header.outerWidth()
|
||||
});
|
||||
stkyCells.each(function(i){
|
||||
$(this).width( hdrCells.eq(i).width() + brdr );
|
||||
stkyCells.find('.tablesorter-header-inner').each(function(i){
|
||||
$(this).width( hdrCells.eq(i).find('.tablesorter-header-inner').width() );
|
||||
});
|
||||
});
|
||||
}
|
||||
|
16
js/jquery.tablesorter.widgets.min.js
vendored
16
js/jquery.tablesorter.widgets.min.js
vendored
@ -1,10 +1,10 @@
|
||||
/*! tableSorter 2.1 widgets - updated 3/22/2012 */
|
||||
/*! tableSorter 2.1 widgets - updated 3/26/2012 */
|
||||
(function(b){
|
||||
b.tablesorter.storage=function(a,e,c){var d,f=!1;d={};var a=a.id||b(".tablesorter").index(b(a)),g=window.location.pathname;try{f=!!localStorage.getItem}catch(j){}c&&JSON&&JSON.hasOwnProperty("stringify")?(d[g]={},d[g][a]={},d[g][a]=c,f?localStorage[e]=JSON.stringify(d):(c=new Date,c.setTime(c.getTime()+31536E6),document.cookie=e+"="+JSON.stringify(d).replace(/\"/g,'"')+"; expires="+c.toGMTString()+"; path=/")):b.parseJSON&&(f?d=b.parseJSON(localStorage[e])||{}:(d=document.cookie.split(/[;\s|=]/), c=b.inArray(e,d)+1,d=0!==c?b.parseJSON(d[c])||{}:{}));return d&&d.hasOwnProperty(g)&&d[g].hasOwnProperty(a)?d[g][a]:{}};
|
||||
b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,c,d,f,g,j=b(a),i=a.config,h=i.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=i.widgetUitheme&&i.widgetUitheme.hasOwnProperty("css")?i.widgetUitheme.css||k:h&&h.hasOwnProperty("uitheme")?h.uitheme:k;d=k.join(" ");i.debug&&(e=new Date);j.hasClass("ui-theme")||(j.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"), b.each(i.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all ui-state-default").append('<span class="ui-icon"/>').wrapInner('<div class="tablesorter-inner"/>').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(i.headerList,function(a){f=b(this);if(this.sortDisabled)f.find("span.ui-icon").removeClass(d+" ui-icon");else{c=f.hasClass(i.cssAsc)?k[1]:f.hasClass(i.cssDesc)?k[2]:f.hasClass(i.cssHeader)?k[0]:"";g=j.hasClass("hasStickyHeaders")? j.find("tr."+h.stickyHeaders||"tablesorter-stickyheader").find("th").eq(a).add(f):f;g[c===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(d).addClass(c)}});i.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}});
|
||||
b.tablesorter.addWidget({id:"columns",format:function(a){var e,c,d,f,g=a.config,j=g.sortList,i=j.length,h=["primary","secondary","tertiary"],h=g.widgetColumns&&g.widgetColumns.hasOwnProperty("css")?g.widgetColumns.css||h:g.widgetOptions&&g.widgetOptions.hasOwnProperty("columns")? g.widgetOptions.columns||h:h;d=h.length-1;f=h.join(" ");g.debug&&(c=new Date);j&&j[0]?b("tr:visible",a.tBodies[0]).each(function(a){e=b(this).children().removeClass(f);e.eq(j[0][0]).addClass(h[0]);if(1<i)for(a=1;a<i;a++)e.eq(j[a][0]).addClass(h[a]||h[d])}):b("td",a.tBodies[0]).removeClass(f);g.debug&&b.tablesorter.benchmark("Applying Columns widget",c)}});
|
||||
b.tablesorter.addWidget({id:"filter",format:function(a){if(!b(a).hasClass("hasFilters")){var e,c,d,f,g,j,i,h=a.config,k=h.widgetOptions,l=k.filter_cssFilter|| "tablesorter-filter",m=h.headerList.length,n=b(a).addClass("hasFilters"),a='<tr class="'+l+'">',o;h.debug&&(o=new Date);for(e=0;e<m;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=h.headers[e]&&h.headers[e].hasOwnProperty("filter")&&!1===h.headers[e].filter||b(h.headerList[e]).is(".filter-false")?' disabled" disabled':'"',a+="></td>";n.find("thead").append(a+="</tr>").find("input."+l).bind("keyup search",function(){c=n.find("thead").find("input."+l).map(function(){return(b(this).val()|| "").toLowerCase()}).get();""===c.join("")?n.find("tr").show():n.find("tbody").find("tr:not(."+h.cssChildRow+")").each(function(){d=!0;j=b(this).nextUntil("tr:not(."+h.cssChildRow+")");f=j.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?j.text():"";i=b(this).find("td");for(e=0;e<m;e++)g=b.inArray(c[e],(i.eq(e).text()+f).toLowerCase()),""!==c[e]&&(!k.filter_startsWith&&0<=g||k.filter_startsWith&&0===g)?d=d?!0:!1:""!==c[e]&&(d=!1);b(this)[d? "show":"hide"]();if(j.length)j[d?"show":"hide"]()});n.trigger("applyWidgets")});h.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
|
||||
b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),c=a.config.widgetOptions,d=b(window),f=b(a).find("thead"),g=f.find("tr").children(),j=c.stickyHeaders||"tablesorter-stickyheader",i=g.eq(0),h=parseInt(i.css("border-left-width"),10),k=f.find("tr.tablesorter-header").clone().removeClass("tablesorter-header").addClass(j).css({width:f.outerWidth(!0)+ h,position:"fixed",left:i.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),l=k.children(),m;e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+j).children();d.filter(":not(."+j+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){d.resize()});g.each(function(a){var c=b(this);l.eq(a).width(c.width()+h).bind("click",function(b){c.trigger(b)}).bind("mousedown",function(){this.onselectstart=function(){return!1}; return!1})});f.prepend(k);d.scroll(function(){var b=i.offset(),a=d.scrollTop(),a=a>b.top&&a<b.top+e.find("tbody").height()?"visible":"hidden";k.css({left:b.left-d.scrollLeft(),visibility:a});a!==m&&(d.resize(),m=a)}).resize(function(){k.css({left:i.offset().left-d.scrollLeft(),width:f.outerWidth()+h});l.each(function(a){b(this).width(g.eq(a).width()+h)})})}}});
|
||||
b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable");var e,c,d=a.config, f=b(d.headerList).filter(":gt(0)"),g=0,j=null,i=null,h=function(){g=0;j=i=null;b(window).trigger("resize")};if(c=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in c)!isNaN(e)&&e<d.headerList.length&&b(d.headerList[e]).width(c[e]);f.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove", function(a){if(0!==g&&j){var b=a.pageX-g;j.width()<-b||i&&i.width()<=b||(i.width(i.width()+b),g=a.pageX)}}).bind("mouseup",function(){c&&b.tablesorter.storage&&j&&(c[i.index()]=i.width(),b.tablesorter.storage(a,"tablesorter-resizable",c));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){j=b(a.target).closest("th");i=j.prev();g=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
|
||||
b.tablesorter.addWidget({id:"saveSort",init:function(a,b,c){c.format(a,!0)}, format:function(a,e){var c,d,f=a.config;c={sortList:f.sortList};f.debug&&(d=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&&b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",c),f.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+f.sortList,d)):(b(a).addClass("hasSaveSort"),c="",b.tablesorter.storage&&(c=(c=b.tablesorter.storage(a,"tablesorter-savesort"))&&c.hasOwnProperty("sortList")&&b.isArray(c.sortList)?c.sortList:"",f.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+ c,d)),e&&c&&0<c.length?f.sortList=c:a.hasInitialized&&c&&0<c.length&&b(a).trigger("sorton",[c]))}})
|
||||
b.tablesorter.storage=function(a,e,d){var c,i;c={};var j=!1,g={},a=a.id||b(".tablesorter").index(b(a)),f=window.location.pathname;try{j=!!localStorage.getItem}catch(h){}b.parseJSON&&(j?c=b.parseJSON(localStorage[e])||{}:(i=document.cookie.split(/[;\s|=]/),c=b.inArray(e,i)+1,c=0!==c?b.parseJSON(i[c])||{}:{}));if(d&&JSON&&JSON.hasOwnProperty("stringify"))g[f]={},g[f][a]={},g[f][a]=d,g=b.extend(c,g),j?localStorage[e]=JSON.stringify(g):(c=new Date,c.setTime(c.getTime()+31536E6),document.cookie= e+"="+JSON.stringify(g).replace(/\"/g,'"')+"; expires="+c.toGMTString()+"; path=/");else return c&&c.hasOwnProperty(f)&&c[f].hasOwnProperty(a)?c[f][a]:{}};
|
||||
b.tablesorter.addWidget({id:"uitheme",format:function(a){var e,d,c,i,j,g=b(a),f=a.config,h=f.widgetOptions,k=["ui-icon-arrowthick-2-n-s","ui-icon-arrowthick-1-s","ui-icon-arrowthick-1-n"],k=f.widgetUitheme&&f.widgetUitheme.hasOwnProperty("css")?f.widgetUitheme.css||k:h&&h.hasOwnProperty("uitheme")?h.uitheme:k;c=k.join(" ");f.debug&&(e=new Date); g.hasClass("ui-theme")||(g.addClass("ui-widget ui-widget-content ui-corner-all ui-theme"),b.each(f.headerList,function(){b(this).addClass("ui-widget-header ui-corner-all ui-state-default").append('<span class="ui-icon"/>').wrapInner('<div class="tablesorter-inner"/>').hover(function(){b(this).addClass("ui-state-hover")},function(){b(this).removeClass("ui-state-hover")})}));b.each(f.headerList,function(a){i=b(this);if(this.sortDisabled)i.find("span.ui-icon").removeClass(c+" ui-icon");else{d=i.hasClass(f.cssAsc)? k[1]:i.hasClass(f.cssDesc)?k[2]:i.hasClass(f.cssHeader)?k[0]:"";j=g.hasClass("hasStickyHeaders")?g.find("tr."+(h.stickyHeaders||"tablesorter-stickyHeader")).find("th").eq(a).add(i):i;j[d===k[0]?"removeClass":"addClass"]("ui-state-active").find("span.ui-icon").removeClass(c).addClass(d)}});f.debug&&b.tablesorter.benchmark("Applying uitheme widget",e)}});
|
||||
b.tablesorter.addWidget({id:"columns",format:function(a){var e,d,c,i,j=a.config,g=j.sortList,f=g.length,h=["primary","secondary","tertiary"],h=j.widgetColumns&& j.widgetColumns.hasOwnProperty("css")?j.widgetColumns.css||h:j.widgetOptions&&j.widgetOptions.hasOwnProperty("columns")?j.widgetOptions.columns||h:h;c=h.length-1;i=h.join(" ");j.debug&&(d=new Date);g&&g[0]?b("tr:visible",a.tBodies[0]).each(function(a){e=b(this).children().removeClass(i);e.eq(g[0][0]).addClass(h[0]);if(1<f)for(a=1;a<f;a++)e.eq(g[a][0]).addClass(h[a]||h[c])}):b("td",a.tBodies[0]).removeClass(i);j.debug&&b.tablesorter.benchmark("Applying Columns widget",d)}});
|
||||
b.tablesorter.addWidget({id:"filter", format:function(a){if(!b(a).hasClass("hasFilters")){var e,d,c,i,j,g,f,h=a.config,k=h.widgetOptions,l=k.filter_cssFilter||"tablesorter-filter",n=h.headerList.length,m=b(a).addClass("hasFilters"),a='<tr class="'+l+'">',o;h.debug&&(o=new Date);for(e=0;e<n;e++)a+='<td><input type="search" data-col="'+e+'" class="'+l,a+=h.headers[e]&&h.headers[e].hasOwnProperty("filter")&&!1===h.headers[e].filter||b(h.headerList[e]).is(".filter-false")?' disabled" disabled':'"',a+="></td>";m.find("thead").append(a+="</tr>").find("input."+ l).bind("keyup search",function(){d=m.find("thead").find("input."+l).map(function(){return(b(this).val()||"").toLowerCase()}).get();""===d.join("")?m.find("tr").show():m.find("tbody").find("tr:not(."+h.cssChildRow+")").each(function(){c=!0;g=b(this).nextUntil("tr:not(."+h.cssChildRow+")");i=g.length&&(k&&k.hasOwnProperty("filter_childRows")&&"undefined"!==typeof k.filter_childRows?k.filter_childRows:1)?g.text():"";f=b(this).find("td");for(e=0;e<n;e++)j=(f.eq(e).text()+i).toLowerCase().indexOf(d[e]), ""!==d[e]&&(!k.filter_startsWith&&0<=j||k.filter_startsWith&&0===j)?c=c?!0:!1:""!==d[e]&&(c=!1);b(this)[c?"show":"hide"]();if(g.length)g[c?"show":"hide"]()});m.trigger("applyWidgets")});h.debug&&b.tablesorter.benchmark("Applying Filter widget",o)}}});
|
||||
b.tablesorter.addWidget({id:"stickyHeaders",format:function(a){if(!b(a).hasClass("hasStickyHeaders")){var e=b(a).addClass("hasStickyHeaders"),d=a.config.widgetOptions,c=b(window),i=b(a).find("thead"),j=i.find("tr").children(),g=d.stickyHeaders||"tablesorter-stickyHeader", f=j.eq(0),h=i.find("tr.tablesorter-header").clone().removeClass("tablesorter-header").addClass(g).css({width:i.outerWidth(!0),position:"fixed",left:f.offset().left,margin:0,top:0,visibility:"hidden",zIndex:10}),k=h.children(),l="";e.bind("sortEnd",function(a,c){var d=b(c).find("thead tr"),e=d.filter("."+g).children();d.filter(":not(."+g+")").children().each(function(a){e.eq(a).attr("class",b(this).attr("class"))})}).bind("pagerComplete",function(){c.resize()});j.each(function(a){var c=b(this);k.eq(a).bind("click", function(b){c.trigger(b)}).bind("mousedown",function(){this.onselectstart=function(){return!1};return!1}).find(".tablesorter-header-inner").width(c.find(".tablesorter-header-inner").width())});i.prepend(h);c.scroll(function(){var b=f.offset(),a=c.scrollTop(),a=a>b.top&&a<b.top+e.find("tbody").height()?"visible":"hidden";h.css({left:b.left-c.scrollLeft(),visibility:a});a!==l&&(c.resize(),l=a)}).resize(function(){h.css({left:f.offset().left-c.scrollLeft(),width:i.outerWidth()});k.find(".tablesorter-header-inner").each(function(a){b(this).width(j.eq(a).find(".tablesorter-header-inner").width())})})}}});
|
||||
b.tablesorter.addWidget({id:"resizable",format:function(a){if(!b(a).hasClass("hasResizable")){b(a).addClass("hasResizable");var e,d,c=a.config,i=b(c.headerList).filter(":gt(0)"),j=0,g=null,f=null,h=function(){j=0;g=f=null;b(window).trigger("resize")};if(d=b.tablesorter.storage?b.tablesorter.storage(a,"tablesorter-resizable"):"")for(e in d)!isNaN(e)&&e<c.headerList.length&&b(c.headerList[e]).width(d[e]);i.each(function(){b(this).append('<div class="tablesorter-resizer" style="cursor:w-resize;position:absolute;height:100%;width:20px;left:-20px;top:0;z-index:1;"></div>').wrapInner('<div style="position:relative;height:100%;width:100%"></div>')}).bind("mousemove", function(a){if(0!==j&&g){var b=a.pageX-j;g.width()<-b||f&&f.width()<=b||(f.width(f.width()+b),j=a.pageX)}}).bind("mouseup",function(){d&&b.tablesorter.storage&&g&&(d[f.index()]=f.width(),b.tablesorter.storage(a,"tablesorter-resizable",d));h();return!1}).find(".tablesorter-resizer").bind("mousedown",function(a){g=b(a.target).closest("th");f=g.prev();j=a.pageX});b(a).find("thead").bind("mouseup mouseleave",function(){h()})}}});
|
||||
b.tablesorter.addWidget({id:"saveSort",init:function(a,b,d){d.format(a,!0)}, format:function(a,e){var d,c,i=a.config;d={sortList:i.sortList};i.debug&&(c=new Date);b(a).hasClass("hasSaveSort")?a.hasInitialized&&b.tablesorter.storage&&(b.tablesorter.storage(a,"tablesorter-savesort",d),i.debug&&b.tablesorter.benchmark("saveSort widget: Saving last sort: "+i.sortList,c)):(b(a).addClass("hasSaveSort"),d="",b.tablesorter.storage&&(d=(d=b.tablesorter.storage(a,"tablesorter-savesort"))&&d.hasOwnProperty("sortList")&&b.isArray(d.sortList)?d.sortList:"",i.debug&&b.tablesorter.benchmark("saveSort: Last sort loaded: "+ d,c)),e&&d&&0<d.length?i.sortList=d:a.hasInitialized&&d&&0<d.length&&b(a).trigger("sorton",[d]))}})
|
||||
})(jQuery);
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tablesorter",
|
||||
"version": "2.1.6",
|
||||
"version": "2.1.7",
|
||||
"title": "tablesorter",
|
||||
"author": {
|
||||
"name": "Christian Bach",
|
||||
|
Loading…
Reference in New Issue
Block a user