mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Global: Add editor eslint & fix issues
This commit is contained in:
parent
aa113834db
commit
03eeb2e819
5
.eslintignore
Normal file
5
.eslintignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
_test*.js
|
||||||
|
*.min.js
|
||||||
|
*mod.js
|
||||||
|
*.metadata.js
|
||||||
|
semver.js
|
31
.eslintrc
Normal file
31
.eslintrc
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jquery": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"curly": 1,
|
||||||
|
"dot-location": [2, "property"],
|
||||||
|
"eqeqeq": 1,
|
||||||
|
"linebreak-style": [2, "unix"],
|
||||||
|
"no-else-return": 0,
|
||||||
|
"no-eval": 2,
|
||||||
|
"no-octal": 2,
|
||||||
|
"no-with": 2,
|
||||||
|
"radix": 2,
|
||||||
|
"brace-style": 0,
|
||||||
|
"camelcase": 0,
|
||||||
|
"indent": 0,
|
||||||
|
"no-array-constructor": 2,
|
||||||
|
"quotes": [2, "single", {
|
||||||
|
"allowTemplateLiterals": true,
|
||||||
|
"avoidEscape": true
|
||||||
|
}],
|
||||||
|
"spaced-comment": 0,
|
||||||
|
"space-before-blocks": 1,
|
||||||
|
"keyword-spacing": 1,
|
||||||
|
"arrow-spacing": 2,
|
||||||
|
"no-var": 0,
|
||||||
|
"no-unused-vars": 1
|
||||||
|
}
|
||||||
|
}
|
@ -4,8 +4,6 @@ module.exports = function( grunt ) {
|
|||||||
|
|
||||||
var pkg = grunt.file.readJSON( 'package.json' ),
|
var pkg = grunt.file.readJSON( 'package.json' ),
|
||||||
tasks,
|
tasks,
|
||||||
widgetFilePrefix,
|
|
||||||
widgetFileSuffix,
|
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
dependencies : {
|
dependencies : {
|
||||||
@ -428,7 +426,7 @@ module.exports = function( grunt ) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function escapeRegExp(str) {
|
function escapeRegExp(str) {
|
||||||
return str.replace(/[$()*+\-.\/?[\\\]^{|}]/g, "\\$&");
|
return str.replace(/[$()*+\-.\/?[\\\]^{|}]/g, '\\$&');
|
||||||
}
|
}
|
||||||
|
|
||||||
// update tablesorter.jquery.json file version numbers to match the package.json version
|
// update tablesorter.jquery.json file version numbers to match the package.json version
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
customAjaxUrl: function(table, url) { return url; },
|
customAjaxUrl: function(table, url) { return url; },
|
||||||
|
|
||||||
// ajax error callback from $.tablesorter.showError function
|
// ajax error callback from $.tablesorter.showError function
|
||||||
// ajaxError: function( config, xhr, settings, exception ){ return exception; };
|
// ajaxError: function( config, xhr, settings, exception ) { return exception; };
|
||||||
// returning false will abort the error message
|
// returning false will abort the error message
|
||||||
ajaxError: null,
|
ajaxError: null,
|
||||||
|
|
||||||
@ -52,7 +52,7 @@
|
|||||||
// ],
|
// ],
|
||||||
// [ "header1", "header2", ... "headerN" ] // optional
|
// [ "header1", "header2", ... "headerN" ] // optional
|
||||||
// ]
|
// ]
|
||||||
ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
|
ajaxProcessing: function( /* ajax */ ) { return [ 0, [], null ]; },
|
||||||
|
|
||||||
// output default: '{page}/{totalPages}'
|
// output default: '{page}/{totalPages}'
|
||||||
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow},
|
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow},
|
||||||
@ -139,12 +139,12 @@
|
|||||||
if ( p.updateArrows ) {
|
if ( p.updateArrows ) {
|
||||||
tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev);
|
tmp = p.$container.find(p.cssFirst + ',' + p.cssPrev);
|
||||||
tmp[ first ? a : r ](d); // toggle disabled class
|
tmp[ first ? a : r ](d); // toggle disabled class
|
||||||
tmp.each(function(){
|
tmp.each(function() {
|
||||||
this.ariaDisabled = first;
|
this.ariaDisabled = first;
|
||||||
});
|
});
|
||||||
tmp = p.$container.find(p.cssNext + ',' + p.cssLast);
|
tmp = p.$container.find(p.cssNext + ',' + p.cssLast);
|
||||||
tmp[ last ? a : r ](d);
|
tmp[ last ? a : r ](d);
|
||||||
tmp.each(function(){
|
tmp.each(function() {
|
||||||
this.ariaDisabled = last;
|
this.ariaDisabled = last;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -203,11 +203,11 @@
|
|||||||
// form the output string (can now get a new output string from the server)
|
// form the output string (can now get a new output string from the server)
|
||||||
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || output : output )
|
s = ( p.ajaxData && p.ajaxData.output ? p.ajaxData.output || output : output )
|
||||||
// {page} = one-based index; {page+#} = zero based index +/- value
|
// {page} = one-based index; {page+#} = zero based index +/- value
|
||||||
.replace(/\{page([\-+]\d+)?\}/gi, function(m, n){
|
.replace(/\{page([\-+]\d+)?\}/gi, function(m, n) {
|
||||||
return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0;
|
return p.totalPages ? p.page + (n ? parseInt(n, 10) : 1) : 0;
|
||||||
})
|
})
|
||||||
// {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
|
// {totalPages}, {extra}, {extra:0} (array) or {extra : key} (object)
|
||||||
.replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m){
|
.replace(/\{\w+(\s*:\s*\w+)?\}/gi, function(m) {
|
||||||
var len, indx,
|
var len, indx,
|
||||||
str = m.replace(/[{}\s]/g, ''),
|
str = m.replace(/[{}\s]/g, ''),
|
||||||
extra = str.split(':'),
|
extra = str.split(':'),
|
||||||
@ -236,7 +236,7 @@
|
|||||||
if ($out.length) {
|
if ($out.length) {
|
||||||
$out[ ($out[0].nodeName === 'INPUT') ? 'val' : 'html' ](s);
|
$out[ ($out[0].nodeName === 'INPUT') ? 'val' : 'html' ](s);
|
||||||
// rebind startRow/page inputs
|
// rebind startRow/page inputs
|
||||||
$out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function(){
|
$out.find('.ts-startRow, .ts-page').unbind('change' + namespace).bind('change' + namespace, function() {
|
||||||
var v = $(this).val(),
|
var v = $(this).val(),
|
||||||
pg = $(this).hasClass('ts-startRow') ? Math.floor( v / sz ) + 1 : v;
|
pg = $(this).hasClass('ts-startRow') ? Math.floor( v / sz ) + 1 : v;
|
||||||
c.$table.triggerHandler('pageSet' + namespace, [ pg ]);
|
c.$table.triggerHandler('pageSet' + namespace, [ pg ]);
|
||||||
@ -357,7 +357,7 @@
|
|||||||
$.data(table, 'pagerLastSize', p.size);
|
$.data(table, 'pagerLastSize', p.size);
|
||||||
},
|
},
|
||||||
|
|
||||||
hideRows = function(table, p){
|
hideRows = function(table, p) {
|
||||||
if (!p.ajaxUrl) {
|
if (!p.ajaxUrl) {
|
||||||
var i,
|
var i,
|
||||||
lastIndex = 0,
|
lastIndex = 0,
|
||||||
@ -370,7 +370,7 @@
|
|||||||
last = 0, // for cache indexing
|
last = 0, // for cache indexing
|
||||||
j = 0; // size counter
|
j = 0; // size counter
|
||||||
p.cacheIndex = [];
|
p.cacheIndex = [];
|
||||||
for ( i = 0; i < l; i++ ){
|
for ( i = 0; i < l; i++ ) {
|
||||||
if ( !p.regexFiltered.test(rows[i].className) ) {
|
if ( !p.regexFiltered.test(rows[i].className) ) {
|
||||||
if (j === s && rows[i].className.match(c.cssChildRow)) {
|
if (j === s && rows[i].className.match(c.cssChildRow)) {
|
||||||
// hide child rows @ start of pager (if already visible)
|
// hide child rows @ start of pager (if already visible)
|
||||||
@ -398,19 +398,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hideRowsSetup = function(table, p){
|
hideRowsSetup = function(table, p) {
|
||||||
p.size = parsePageSize( p, p.$container.find(p.cssPageSize).val(), 'get' );
|
p.size = parsePageSize( p, p.$container.find(p.cssPageSize).val(), 'get' );
|
||||||
setPageSize( table, p.size, p );
|
setPageSize( table, p.size, p );
|
||||||
pagerArrows( table, p );
|
pagerArrows( table, p );
|
||||||
if ( !p.removeRows ) {
|
if ( !p.removeRows ) {
|
||||||
hideRows(table, p);
|
hideRows(table, p);
|
||||||
$(table).bind('sortEnd filterEnd '.split(' ').join(table.config.namespace + 'pager '), function(){
|
$(table).bind('sortEnd filterEnd '.split(' ').join(table.config.namespace + 'pager '), function() {
|
||||||
hideRows(table, p);
|
hideRows(table, p);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderAjax = function(data, table, p, xhr, settings, exception){
|
renderAjax = function(data, table, p, xhr, settings, exception) {
|
||||||
// process data
|
// process data
|
||||||
if ( typeof p.ajaxProcessing === 'function' ) {
|
if ( typeof p.ajaxProcessing === 'function' ) {
|
||||||
|
|
||||||
@ -424,9 +424,7 @@
|
|||||||
c = table.config,
|
c = table.config,
|
||||||
$table = c.$table,
|
$table = c.$table,
|
||||||
tds = '',
|
tds = '',
|
||||||
result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ],
|
result = p.ajaxProcessing(data, table, xhr) || [ 0, [] ];
|
||||||
hl = $table.find('thead th').length;
|
|
||||||
|
|
||||||
// Clean up any previous error.
|
// Clean up any previous error.
|
||||||
ts.showError( table );
|
ts.showError( table );
|
||||||
|
|
||||||
@ -524,11 +522,11 @@
|
|||||||
p.last.sortList = (c.sortList || []).join(',');
|
p.last.sortList = (c.sortList || []).join(',');
|
||||||
updatePageDisplay(table, p, false);
|
updatePageDisplay(table, p, false);
|
||||||
// tablesorter core updateCache (not pager)
|
// tablesorter core updateCache (not pager)
|
||||||
ts.updateCache( c, function(){
|
ts.updateCache( c, function() {
|
||||||
if (p.initialized) {
|
if (p.initialized) {
|
||||||
// apply widgets after table has rendered & after a delay to prevent
|
// apply widgets after table has rendered & after a delay to prevent
|
||||||
// multiple applyWidget blocking code from blocking this trigger
|
// multiple applyWidget blocking code from blocking this trigger
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
console.log('Pager: Triggering pagerChange');
|
console.log('Pager: Triggering pagerChange');
|
||||||
}
|
}
|
||||||
@ -566,7 +564,7 @@
|
|||||||
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
p.ajaxObject.url = url; // from the ajaxUrl option and modified by customAjaxUrl
|
||||||
p.ajaxObject.success = function(data, status, jqxhr) {
|
p.ajaxObject.success = function(data, status, jqxhr) {
|
||||||
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
// Refuse to process old ajax commands that were overwritten by new ones - see #443
|
||||||
if (counter < p.ajaxCounter){
|
if (counter < p.ajaxCounter) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
renderAjax(data, table, p, jqxhr);
|
renderAjax(data, table, p, jqxhr);
|
||||||
@ -587,7 +585,7 @@
|
|||||||
c = table.config,
|
c = table.config,
|
||||||
url = (p.ajaxUrl) ? p.ajaxUrl
|
url = (p.ajaxUrl) ? p.ajaxUrl
|
||||||
// allow using "{page+1}" in the url string to switch to a non-zero based index
|
// allow using "{page+1}" in the url string to switch to a non-zero based index
|
||||||
.replace(/\{page([\-+]\d+)?\}/, function(s, n){ return p.page + (n ? parseInt(n, 10) : 0); })
|
.replace(/\{page([\-+]\d+)?\}/, function(s, n) { return p.page + (n ? parseInt(n, 10) : 0); })
|
||||||
// this will pass "all" to server when size is set to "all"
|
// this will pass "all" to server when size is set to "all"
|
||||||
.replace(/\{size\}/g, p.size) : '',
|
.replace(/\{size\}/g, p.size) : '',
|
||||||
sortList = c.sortList,
|
sortList = c.sortList,
|
||||||
@ -664,7 +662,7 @@
|
|||||||
count = f ? 0 : s;
|
count = f ? 0 : s;
|
||||||
added = 0;
|
added = 0;
|
||||||
while (added < e && index < rows.length) {
|
while (added < e && index < rows.length) {
|
||||||
if (!f || !p.regexFiltered.test(rows[index][0].className)){
|
if (!f || !p.regexFiltered.test(rows[index][0].className)) {
|
||||||
count++;
|
count++;
|
||||||
if (count > s && added <= e) {
|
if (count > s && added <= e) {
|
||||||
added++;
|
added++;
|
||||||
@ -720,7 +718,7 @@
|
|||||||
var c = table.config,
|
var c = table.config,
|
||||||
p = c.pager;
|
p = c.pager;
|
||||||
// tablesorter core updateCache (not pager)
|
// tablesorter core updateCache (not pager)
|
||||||
ts.updateCache( c, function(){
|
ts.updateCache( c, function() {
|
||||||
var i,
|
var i,
|
||||||
rows = [],
|
rows = [],
|
||||||
n = table.config.cache[0].normalized;
|
n = table.config.cache[0].normalized;
|
||||||
@ -908,7 +906,7 @@
|
|||||||
p.$container.find(p.cssGoto + ',' + p.cssPageSize + ',.ts-startRow, .ts-page')
|
p.$container.find(p.cssGoto + ',' + p.cssPageSize + ',.ts-startRow, .ts-page')
|
||||||
.removeClass(p.cssDisabled)
|
.removeClass(p.cssDisabled)
|
||||||
.removeAttr('disabled')
|
.removeAttr('disabled')
|
||||||
.each(function(){
|
.each(function() {
|
||||||
this.ariaDisabled = false;
|
this.ariaDisabled = false;
|
||||||
});
|
});
|
||||||
p.isDisabled = false;
|
p.isDisabled = false;
|
||||||
@ -943,7 +941,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
init = function(table, settings) {
|
init = function(table, settings) {
|
||||||
var t, ctrls, fxn, size, $el,
|
var t, ctrls, fxn, $el,
|
||||||
c = table.config,
|
c = table.config,
|
||||||
wo = c.widgetOptions,
|
wo = c.widgetOptions,
|
||||||
p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ),
|
p = c.pager = $.extend( true, {}, $.tablesorterPager.defaults, settings ),
|
||||||
@ -1003,23 +1001,23 @@
|
|||||||
ts.applyWidget( table );
|
ts.applyWidget( table );
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.bind('disablePager' + namespace, function(e){
|
.bind('disablePager' + namespace, function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
showAllRows(table, p);
|
showAllRows(table, p);
|
||||||
})
|
})
|
||||||
.bind('enablePager' + namespace, function(e){
|
.bind('enablePager' + namespace, function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
enablePager(table, p, true);
|
enablePager(table, p, true);
|
||||||
})
|
})
|
||||||
.bind('destroyPager' + namespace, function(e){
|
.bind('destroyPager' + namespace, function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
destroyPager(table, p);
|
destroyPager(table, p);
|
||||||
})
|
})
|
||||||
.bind('resetToLoadState' + namespace, function(e){
|
.bind('resetToLoadState' + namespace, function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
resetState(table, p);
|
resetState(table, p);
|
||||||
})
|
})
|
||||||
.bind('updateComplete' + namespace, function(e, table, triggered){
|
.bind('updateComplete' + namespace, function(e, table, triggered) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
|
// table can be unintentionally undefined in tablesorter v2.17.7 and earlier
|
||||||
// don't recalculate total rows/pages if using ajax
|
// don't recalculate total rows/pages if using ajax
|
||||||
@ -1038,14 +1036,14 @@
|
|||||||
changeHeight(table, p);
|
changeHeight(table, p);
|
||||||
updatePageDisplay(table, p, true);
|
updatePageDisplay(table, p, true);
|
||||||
})
|
})
|
||||||
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size){
|
.bind('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, size) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
setPageSize(table, parsePageSize( p, size, 'get' ), p);
|
setPageSize(table, parsePageSize( p, size, 'get' ), p);
|
||||||
moveToPage(table, p);
|
moveToPage(table, p);
|
||||||
hideRows(table, p);
|
hideRows(table, p);
|
||||||
updatePageDisplay(table, p, false);
|
updatePageDisplay(table, p, false);
|
||||||
})
|
})
|
||||||
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num){
|
.bind('pageSet pagerUpdate '.split(' ').join(namespace + ' '), function(e, num) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
// force pager refresh
|
// force pager refresh
|
||||||
if (e.type === 'pagerUpdate') {
|
if (e.type === 'pagerUpdate') {
|
||||||
@ -1056,7 +1054,7 @@
|
|||||||
moveToPage(table, p, true);
|
moveToPage(table, p, true);
|
||||||
updatePageDisplay(table, p, false);
|
updatePageDisplay(table, p, false);
|
||||||
})
|
})
|
||||||
.bind('pageAndSize' + namespace, function(e, page, size){
|
.bind('pageAndSize' + namespace, function(e, page, size) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
p.page = (parseInt(page, 10) || 1) - 1;
|
p.page = (parseInt(page, 10) || 1) - 1;
|
||||||
setPageSize(table, parsePageSize( p, size, 'get' ), p);
|
setPageSize(table, parsePageSize( p, size, 'get' ), p);
|
||||||
@ -1074,7 +1072,7 @@
|
|||||||
pager.find(ctrls.join(','))
|
pager.find(ctrls.join(','))
|
||||||
.attr('tabindex', 0)
|
.attr('tabindex', 0)
|
||||||
.unbind('click' + namespace)
|
.unbind('click' + namespace)
|
||||||
.bind('click' + namespace, function(e){
|
.bind('click' + namespace, function(e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
var i, $t = $(this), l = ctrls.length;
|
var i, $t = $(this), l = ctrls.length;
|
||||||
if ( !$t.hasClass(p.cssDisabled) ) {
|
if ( !$t.hasClass(p.cssDisabled) ) {
|
||||||
@ -1092,7 +1090,7 @@
|
|||||||
if ( $el.length ) {
|
if ( $el.length ) {
|
||||||
$el
|
$el
|
||||||
.unbind('change' + namespace)
|
.unbind('change' + namespace)
|
||||||
.bind('change' + namespace, function(){
|
.bind('change' + namespace, function() {
|
||||||
p.page = $(this).val() - 1;
|
p.page = $(this).val() - 1;
|
||||||
moveToPage(table, p, true);
|
moveToPage(table, p, true);
|
||||||
updatePageDisplay(table, p, false);
|
updatePageDisplay(table, p, false);
|
||||||
@ -1187,8 +1185,7 @@
|
|||||||
|
|
||||||
// see #486
|
// see #486
|
||||||
ts.showError = function( table, xhr, settings, exception ) {
|
ts.showError = function( table, xhr, settings, exception ) {
|
||||||
var $row,
|
var $table = $( table ),
|
||||||
$table = $( table ),
|
|
||||||
c = $table[0].config,
|
c = $table[0].config,
|
||||||
wo = c && c.widgetOptions,
|
wo = c && c.widgetOptions,
|
||||||
errorRow = c.pager && c.pager.cssErrorRow ||
|
errorRow = c.pager && c.pager.cssErrorRow ||
|
||||||
@ -1197,7 +1194,7 @@
|
|||||||
typ = typeof xhr,
|
typ = typeof xhr,
|
||||||
valid = true,
|
valid = true,
|
||||||
message = '',
|
message = '',
|
||||||
removeRow = function(){
|
removeRow = function() {
|
||||||
c.$table.find( 'thead' ).find( c.selectorRemove ).remove();
|
c.$table.find( 'thead' ).find( c.selectorRemove ).remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1243,7 +1240,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// allow message to include entire row HTML!
|
// allow message to include entire row HTML!
|
||||||
$row = ( /tr\>/.test(message) ? $(message) : $('<tr><td colspan="' + c.columns + '">' + message + '</td></tr>') )
|
$( /tr\>/.test(message) ? message : '<tr><td colspan="' + c.columns + '">' + message + '</td></tr>' )
|
||||||
.click( function() {
|
.click( function() {
|
||||||
$( this ).remove();
|
$( this ).remove();
|
||||||
})
|
})
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
/*jshint browser:true, jquery:true, unused:false */
|
/*jshint browser:true, jquery:true, unused:false */
|
||||||
/*global jQuery: false */
|
/*global jQuery: false */
|
||||||
;(function($){
|
;(function($) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
$.tablesorter.addWidget({
|
$.tablesorter.addWidget({
|
||||||
id: 'reorder',
|
id: 'reorder',
|
||||||
@ -22,14 +22,13 @@ $.tablesorter.addWidget({
|
|||||||
init: function(table, thisWidget, c, wo) {
|
init: function(table, thisWidget, c, wo) {
|
||||||
var i, timer, $helper, $bar, clickOffset,
|
var i, timer, $helper, $bar, clickOffset,
|
||||||
lastIndx = -1,
|
lastIndx = -1,
|
||||||
ts = $.tablesorter,
|
|
||||||
endIndex = -1,
|
endIndex = -1,
|
||||||
startIndex = -1,
|
startIndex = -1,
|
||||||
t = wo.reorder_blocked.split(' '),
|
t = wo.reorder_blocked.split(' '),
|
||||||
noReorderLeft = t[0] || 'reorder-block-left',
|
noReorderLeft = t[0] || 'reorder-block-left',
|
||||||
noReorderLast = t[1] || 'reorder-block-end',
|
noReorderLast = t[1] || 'reorder-block-end',
|
||||||
lastOffset = c.$headers.not('.' + noReorderLeft).first(),
|
lastOffset = c.$headers.not('.' + noReorderLeft).first(),
|
||||||
offsets = c.$headers.map(function(i){
|
offsets = c.$headers.map(function() {
|
||||||
var s, $t = $(this);
|
var s, $t = $(this);
|
||||||
if ($t.hasClass(noReorderLeft)) {
|
if ($t.hasClass(noReorderLeft)) {
|
||||||
s = lastOffset;
|
s = lastOffset;
|
||||||
@ -40,7 +39,7 @@ $.tablesorter.addWidget({
|
|||||||
return $t.offset().left;
|
return $t.offset().left;
|
||||||
}).get(),
|
}).get(),
|
||||||
len = offsets.length,
|
len = offsets.length,
|
||||||
startReorder = function(e, $th){
|
startReorder = function(e, $th) {
|
||||||
var p = $th.position(),
|
var p = $th.position(),
|
||||||
r = $th.parent().position(),
|
r = $th.parent().position(),
|
||||||
i = startIndex = $th.index();
|
i = startIndex = $th.index();
|
||||||
@ -68,7 +67,7 @@ $.tablesorter.addWidget({
|
|||||||
positionBar(e);
|
positionBar(e);
|
||||||
lastIndx = endIndex;
|
lastIndx = endIndex;
|
||||||
},
|
},
|
||||||
positionBar = function(e){
|
positionBar = function(e) {
|
||||||
for (i = 0; i <= len; i++) {
|
for (i = 0; i <= len; i++) {
|
||||||
if ( i > 0 && e.pageX < offsets[i-1] + (offsets[i] - offsets[i-1])/2 && !c.$headers.eq(i).hasClass(noReorderLeft) ) {
|
if ( i > 0 && e.pageX < offsets[i-1] + (offsets[i] - offsets[i-1])/2 && !c.$headers.eq(i).hasClass(noReorderLeft) ) {
|
||||||
endIndex = i - 1;
|
endIndex = i - 1;
|
||||||
@ -87,7 +86,7 @@ $.tablesorter.addWidget({
|
|||||||
$bar.css('left', offsets[len]);
|
$bar.css('left', offsets[len]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
finishReorder = function(){
|
finishReorder = function() {
|
||||||
$helper.remove();
|
$helper.remove();
|
||||||
$bar.remove();
|
$bar.remove();
|
||||||
// finish reorder
|
// finish reorder
|
||||||
@ -95,7 +94,7 @@ $.tablesorter.addWidget({
|
|||||||
rows = c.$table.find('tr'),
|
rows = c.$table.find('tr'),
|
||||||
cols;
|
cols;
|
||||||
startIndex = -1; // stop mousemove updates
|
startIndex = -1; // stop mousemove updates
|
||||||
if ( s > -1 && endIndex > -1 && s != endIndex && s + 1 !== endIndex ) {
|
if ( s > -1 && endIndex > -1 && s !== endIndex && s + 1 !== endIndex ) {
|
||||||
adj = endIndex !== 0;
|
adj = endIndex !== 0;
|
||||||
if (c.debug) {
|
if (c.debug) {
|
||||||
console.log( 'Inserting column ' + s + (adj ? ' after' : ' before') + ' column ' + (endIndex - adj ? 1 : 0) );
|
console.log( 'Inserting column ' + s + (adj ? ' after' : ' before') + ' column ' + (endIndex - adj ? 1 : 0) );
|
||||||
@ -123,10 +122,10 @@ $.tablesorter.addWidget({
|
|||||||
}
|
}
|
||||||
endIndex = -1;
|
endIndex = -1;
|
||||||
},
|
},
|
||||||
mdown = function(e, el){
|
mdown = function(e, el) {
|
||||||
var $t = $(el), evt = e;
|
var $t = $(el), evt = e;
|
||||||
if ($t.hasClass(wo.reorder_noReorder)) { return; }
|
if ($t.hasClass(wo.reorder_noReorder)) { return; }
|
||||||
timer = setTimeout(function(){
|
timer = setTimeout(function() {
|
||||||
$t.addClass('tablesorter-reorder');
|
$t.addClass('tablesorter-reorder');
|
||||||
startReorder(evt, $t);
|
startReorder(evt, $t);
|
||||||
}, wo.reorder_delay);
|
}, wo.reorder_delay);
|
||||||
@ -140,13 +139,13 @@ $.tablesorter.addWidget({
|
|||||||
offsets.push( c.$table.offset().left + c.$table.outerWidth() );
|
offsets.push( c.$table.offset().left + c.$table.outerWidth() );
|
||||||
}
|
}
|
||||||
|
|
||||||
c.$headers.not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){
|
c.$headers.not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e) {
|
||||||
mdown(e, this);
|
mdown(e, this);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document)
|
$(document)
|
||||||
.bind('mousemove.reorder', function(e){
|
.bind('mousemove.reorder', function(e) {
|
||||||
if (startIndex !== -1){
|
if (startIndex !== -1) {
|
||||||
var c = { left : e.pageX - clickOffset[0] };
|
var c = { left : e.pageX - clickOffset[0] };
|
||||||
endIndex = -1;
|
endIndex = -1;
|
||||||
if (/y/.test(wo.reorder_axis)) {
|
if (/y/.test(wo.reorder_axis)) {
|
||||||
@ -157,9 +156,9 @@ $.tablesorter.addWidget({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.add( c.$headers )
|
.add( c.$headers )
|
||||||
.bind('mouseup.reorder', function(){
|
.bind('mouseup.reorder', function() {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
if (startIndex !== -1 && endIndex !== -1){
|
if (startIndex !== -1 && endIndex !== -1) {
|
||||||
finishReorder();
|
finishReorder();
|
||||||
} else {
|
} else {
|
||||||
startIndex = -1;
|
startIndex = -1;
|
||||||
@ -167,8 +166,8 @@ $.tablesorter.addWidget({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// has sticky headers?
|
// has sticky headers?
|
||||||
c.$table.bind('stickyHeadersInit', function(){
|
c.$table.bind('stickyHeadersInit', function() {
|
||||||
wo.$sticky.find('thead').children().not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e){
|
wo.$sticky.find('thead').children().not('.' + wo.reorder_noReorder).bind('mousedown.reorder', function(e) {
|
||||||
mdown(e, this);
|
mdown(e, this);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -177,6 +176,6 @@ $.tablesorter.addWidget({
|
|||||||
});
|
});
|
||||||
|
|
||||||
// add mouse coordinates
|
// add mouse coordinates
|
||||||
$x = $('#main h1:last'); $(document).mousemove(function(e){ $x.html( e.pageX ); });
|
$x = $('#main h1:last'); $(document).mousemove(function(e) { $x.html( e.pageX ); });
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
// Add two new rows using the "addRows" method
|
// Add two new rows using the "addRows" method
|
||||||
// the "update" method doesn't work here because not all
|
// the "update" method doesn't work here because not all
|
||||||
// rows are present in the table when the pager is applied
|
// rows are present in the table when the pager is applied
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
// add two rows
|
// add two rows
|
||||||
var row = '<tr><td>Frank</td><td>Smith</td><td>53</td><td>$39.95</td><td>22%</td><td>Mar 22, 2011 9:33 AM</td></tr>' +
|
var row = '<tr><td>Frank</td><td>Smith</td><td>53</td><td>$39.95</td><td>22%</td><td>Mar 22, 2011 9:33 AM</td></tr>' +
|
||||||
'<tr><td>Inigo</td><td>Montoya</td><td>34</td><td>$19.99</td><td>15%</td><td>Sep 25, 1987 12:00PM</td></tr>',
|
'<tr><td>Inigo</td><td>Montoya</td><td>34</td><td>$19.99</td><td>15%</td><td>Sep 25, 1987 12:00PM</td></tr>',
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
// call the tablesorter plugin
|
// call the tablesorter plugin
|
||||||
$('table').tablesorter({ theme : 'blue' });
|
$('table').tablesorter({ theme : 'blue' });
|
||||||
|
|
||||||
$('button.applyid').click(function(){
|
$('button.applyid').click(function() {
|
||||||
// This method adds the 'columns' widget & sorts the table to make it visible
|
// This method adds the 'columns' widget & sorts the table to make it visible
|
||||||
$('table')
|
$('table')
|
||||||
.trigger('applyWidgetId', 'columns')
|
.trigger('applyWidgetId', 'columns')
|
||||||
@ -31,7 +31,7 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.apply').click(function(){
|
$('button.apply').click(function() {
|
||||||
// This method reapplies the widgets listed in table.config.widgets
|
// This method reapplies the widgets listed in table.config.widgets
|
||||||
// it won't appear to do anything unless we add 'zebra' to the widgets option
|
// it won't appear to do anything unless we add 'zebra' to the widgets option
|
||||||
$('table').data('tablesorter').widgets = ['zebra'];
|
$('table').data('tablesorter').widgets = ['zebra'];
|
||||||
@ -39,7 +39,7 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.remove').click(function(){
|
$('button.remove').click(function() {
|
||||||
// This method removes both the zebra & columns widget entirely
|
// This method removes both the zebra & columns widget entirely
|
||||||
$('table').trigger('removeWidget', 'zebra columns');
|
$('table').trigger('removeWidget', 'zebra columns');
|
||||||
return false;
|
return false;
|
||||||
|
@ -151,7 +151,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Toggle filter_childByColumn option
|
// Toggle filter_childByColumn option
|
||||||
$( 'button.toggle-byColumn' ).click(function(){
|
$( 'button.toggle-byColumn' ).click(function() {
|
||||||
var wo = $table2[0].config.widgetOptions,
|
var wo = $table2[0].config.widgetOptions,
|
||||||
o = !wo.filter_childByColumn;
|
o = !wo.filter_childByColumn;
|
||||||
wo.filter_childByColumn = o;
|
wo.filter_childByColumn = o;
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
positionFixed: false
|
positionFixed: false
|
||||||
});
|
});
|
||||||
/* no longer needed!
|
/* no longer needed!
|
||||||
.bind('pagerChange', function(){
|
.bind('pagerChange', function() {
|
||||||
// hide child rows after pager update
|
// hide child rows after pager update
|
||||||
$('.tablesorter-childRow td').hide();
|
$('.tablesorter-childRow td').hide();
|
||||||
});
|
});
|
||||||
@ -45,7 +45,7 @@
|
|||||||
// Toggle child row content (td), not hiding the row since we are using rowspan
|
// Toggle child row content (td), not hiding the row since we are using rowspan
|
||||||
// Using delegate because the pager plugin rebuilds the table after each page change
|
// Using delegate because the pager plugin rebuilds the table after each page change
|
||||||
// "delegate" works in jQuery 1.4.2+; use "live" back to v1.3; for older jQuery - SOL
|
// "delegate" works in jQuery 1.4.2+; use "live" back to v1.3; for older jQuery - SOL
|
||||||
$('.tablesorter').delegate('.toggle', 'click' ,function(){
|
$('.tablesorter').delegate('.toggle', 'click' ,function() {
|
||||||
|
|
||||||
// use "nextUntil" to toggle multiple child rows
|
// use "nextUntil" to toggle multiple child rows
|
||||||
// toggle table cells instead of the row
|
// toggle table cells instead of the row
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<script src="../js/widgets/widget-filter.js"></script>
|
<script src="../js/widgets/widget-filter.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
var dupe = true;
|
var dupe = true;
|
||||||
$( '#dupe' ).click( function() {
|
$( '#dupe' ).click( function() {
|
||||||
dupe = !dupe;
|
dupe = !dupe;
|
||||||
@ -32,7 +32,7 @@
|
|||||||
$('table').on('filterEnd', function( event, c ) {
|
$('table').on('filterEnd', function( event, c ) {
|
||||||
$( '#show-filter' ).html( '[ "' + c.lastSearch.join('", "') + '" ]' );
|
$( '#show-filter' ).html( '[ "' + c.lastSearch.join('", "') + '" ]' );
|
||||||
});
|
});
|
||||||
$('.search').click(function(){
|
$('.search').click(function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
filter = [],
|
filter = [],
|
||||||
col = $this.attr( 'data-column' );
|
col = $this.attr( 'data-column' );
|
||||||
|
@ -343,16 +343,16 @@ table.focus-highlight td:before {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* highlight hover & focus selectors in the syntax highlighted code */
|
/* highlight hover & focus selectors in the syntax highlighted code */
|
||||||
$(window).on('load', function(){
|
$(window).on('load', function() {
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
// css
|
// css
|
||||||
$('.pln:contains(highlight)').each(function(){
|
$('.pln:contains(highlight)').each(function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
$prev = $this.prev().prev(),
|
$prev = $this.prev().prev(),
|
||||||
text = $prev.text() || '',
|
text = $prev.text() || '',
|
||||||
type = /hover/.test(text) ? 'hover-hl' : /focus/.test(text) ? 'focus-hl' : '';
|
type = /hover/.test(text) ? 'hover-hl' : /focus/.test(text) ? 'focus-hl' : '';
|
||||||
if (type) {
|
if (type) {
|
||||||
$this.html(function(i,h){
|
$this.html(function(i,h) {
|
||||||
return h.replace('highlight', '<span>highlight</span>');
|
return h.replace('highlight', '<span>highlight</span>');
|
||||||
});
|
});
|
||||||
// "highlight".. "-" .... "hover"/"focus" ... "."
|
// "highlight".. "-" .... "hover"/"focus" ... "."
|
||||||
|
@ -62,7 +62,7 @@ div.table-handle-disabled {
|
|||||||
// this option MUST match the tablesorter selectorSort option!
|
// this option MUST match the tablesorter selectorSort option!
|
||||||
sortClass: '.sorter',
|
sortClass: '.sorter',
|
||||||
// this function is called after everything has been updated
|
// this function is called after everything has been updated
|
||||||
tablesorterComplete: function(table){},
|
tablesorterComplete: function(table) {},
|
||||||
|
|
||||||
// *** original dragtable settings (non-default) ***
|
// *** original dragtable settings (non-default) ***
|
||||||
dragaccept: '.drag-enable', // class name of draggable cols -> default null = all columns draggable
|
dragaccept: '.drag-enable', // class name of draggable cols -> default null = all columns draggable
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
widgets: ['zebra']
|
widgets: ['zebra']
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
$('table').trigger('sortReset');
|
$('table').trigger('sortReset');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
// alphanumeric sort from sugar v2.0+ (https://sugarjs.com/docs/#/Array/getOption)
|
// alphanumeric sort from sugar v2.0+ (https://sugarjs.com/docs/#/Array/getOption)
|
||||||
1 : Sugar.Array.getOption('sortCollate'),
|
1 : Sugar.Array.getOption('sortCollate'),
|
||||||
// function parameters were previously (a, b, table, column) - *** THEY HAVE CHANGED!!! ***
|
// function parameters were previously (a, b, table, column) - *** THEY HAVE CHANGED!!! ***
|
||||||
2 : function(a, b, direction, column, table){
|
2 : function(a, b, direction, column, table) {
|
||||||
// this is the original sort method from tablesorter 2.0.3
|
// this is the original sort method from tablesorter 2.0.3
|
||||||
if (table.config.sortLocaleCompare) { return a.localeCompare(b); }
|
if (table.config.sortLocaleCompare) { return a.localeCompare(b); }
|
||||||
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
$("table").tablesorter({
|
$("table").tablesorter({
|
||||||
theme : 'blue',
|
theme : 'blue',
|
||||||
headerTemplate: '{content} {icon}',
|
headerTemplate: '{content} {icon}',
|
||||||
onRenderHeader: function(index){
|
onRenderHeader: function(index) {
|
||||||
// the TH content is wrapped with a div.tablesorter-header-inner by default, so just add the new class
|
// the TH content is wrapped with a div.tablesorter-header-inner by default, so just add the new class
|
||||||
$(this).find('div').addClass('roundedCorners header' + index );
|
$(this).find('div').addClass('roundedCorners header' + index );
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
// {icon} isn't used by the blue theme; it is optional here
|
// {icon} isn't used by the blue theme; it is optional here
|
||||||
headerTemplate : '{icon}{content}',
|
headerTemplate : '{icon}{content}',
|
||||||
// manipulate the template string after is it created
|
// manipulate the template string after is it created
|
||||||
onRenderTemplate : function(i, t){
|
onRenderTemplate : function(i, t) {
|
||||||
// add the column number to the beginning
|
// add the column number to the beginning
|
||||||
// it's a zero-based index, so we add one
|
// it's a zero-based index, so we add one
|
||||||
return '<em>' + (i+1) + ':</em> ' + t;
|
return '<em>' + (i+1) + ':</em> ' + t;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
var t, start,
|
var t, start,
|
||||||
vis = false;
|
vis = false;
|
||||||
|
|
||||||
@ -53,12 +53,12 @@
|
|||||||
$("#display").append(t).find('li:first').remove();
|
$("#display").append(t).find('li:first').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
vis = !vis;
|
vis = !vis;
|
||||||
$.tablesorter.isProcessing($("table"), vis);
|
$.tablesorter.isProcessing($("table"), vis);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('[data-search]').click(function(){
|
$('[data-search]').click(function() {
|
||||||
var search = $(this).attr('data-search').split(',');
|
var search = $(this).attr('data-search').split(',');
|
||||||
$('table').trigger('search', [search]);
|
$('table').trigger('search', [search]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
// show sortList
|
// show sortList
|
||||||
$('table').on('sortEnd', function(){
|
$('table').on('sortEnd', function() {
|
||||||
var indx,
|
var indx,
|
||||||
list = ' [ ',
|
list = ' [ ',
|
||||||
sortList = this.config.sortList,
|
sortList = this.config.sortList,
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('select').change(function(){
|
$('select').change(function() {
|
||||||
var t = $('table'),
|
var t = $('table'),
|
||||||
v = $(this).val();
|
v = $(this).val();
|
||||||
t[0].config.emptyTo = v;
|
t[0].config.emptyTo = v;
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
// In this example, textExtraction 1-5 functions don't really need to
|
// In this example, textExtraction 1-5 functions don't really need to
|
||||||
// be defined, since they can also be obtained using `$(node).text()`
|
// be defined, since they can also be obtained using `$(node).text()`
|
||||||
textExtraction: {
|
textExtraction: {
|
||||||
0: function(node, table, cellIndex){ return $(node).find("strong").text(); },
|
0: function(node, table, cellIndex) { return $(node).find("strong").text(); },
|
||||||
1: function(node, table, cellIndex){ return $(node).find("div").text(); },
|
1: function(node, table, cellIndex) { return $(node).find("div").text(); },
|
||||||
2: function(node, table, cellIndex){ return $(node).find("span").text(); },
|
2: function(node, table, cellIndex) { return $(node).find("span").text(); },
|
||||||
3: function(node, table, cellIndex){ return $(node).find("em").text(); },
|
3: function(node, table, cellIndex) { return $(node).find("em").text(); },
|
||||||
4: function(node, table, cellIndex){ return $(node).find("a").text(); },
|
4: function(node, table, cellIndex) { return $(node).find("a").text(); },
|
||||||
'.date' : function(node, table, cellIndex){ return $(node).find("u").text(); }
|
'.date' : function(node, table, cellIndex) { return $(node).find("u").text(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -39,12 +39,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// extra code to highlight invalid semver numbers
|
// extra code to highlight invalid semver numbers
|
||||||
initialized : function(table){
|
initialized : function(table) {
|
||||||
var $cell,
|
var $cell,
|
||||||
c = table.config,
|
c = table.config,
|
||||||
column = 1; // search second column (zero-based index)
|
column = 1; // search second column (zero-based index)
|
||||||
if (window.semver) {
|
if (window.semver) {
|
||||||
c.$tbodies.each(function(tbindex, tb){
|
c.$tbodies.each(function(tbindex, tb) {
|
||||||
$(tb).children('tr').each(function(rowindex, tr) {
|
$(tb).children('tr').each(function(rowindex, tr) {
|
||||||
$cell = $(tr).children().eq(column);
|
$cell = $(tr).children().eq(column);
|
||||||
if (semver.valid( $.trim( $cell.text() ) ) === null) {
|
if (semver.valid( $.trim( $cell.text() ) ) === null) {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<script id="js">$(function() {
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// NOTE: $.tablesorter.theme.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
|
// NOTE: $.tablesorter.themes.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
|
||||||
// file for Bootstrap v3.x; it is included here because of class name differences in Bootstrap v2
|
// file for Bootstrap v3.x; it is included here because of class name differences in Bootstrap v2
|
||||||
// for version 2.x (the iconSortAsc & iconSortDesc use different classes)
|
// for version 2.x (the iconSortAsc & iconSortDesc use different classes)
|
||||||
$.tablesorter.themes.bootstrap = {
|
$.tablesorter.themes.bootstrap = {
|
||||||
@ -103,10 +103,10 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// filter button demo code
|
// filter button demo code
|
||||||
$('button.filter').click(function(){
|
$('button.filter').click(function() {
|
||||||
var col = $(this).data('column'),
|
var col = $(this).data('column'),
|
||||||
txt = $(this).data('filter');
|
txt = $(this).data('filter');
|
||||||
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
||||||
@ -115,7 +115,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// toggle zebra widget
|
// toggle zebra widget
|
||||||
$('button.zebra').click(function(){
|
$('button.zebra').click(function() {
|
||||||
var t = $(this).hasClass('btn-success');
|
var t = $(this).hasClass('btn-success');
|
||||||
// if (t) {
|
// if (t) {
|
||||||
// removing classes applied by the zebra widget
|
// removing classes applied by the zebra widget
|
||||||
@ -297,7 +297,7 @@
|
|||||||
|
|
||||||
<div class="next-up">
|
<div class="next-up">
|
||||||
<hr />
|
<hr />
|
||||||
Next up: <a href="example-widget-resizable.html">Resizable Columns widget ››</a>
|
Next up: <a href="example-widget-vertical-group.html">Vertical group widget ››</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<script id="js">$(function() {
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// NOTE: $.tablesorter.theme.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
|
// NOTE: $.tablesorter.themes.bootstrap is ALREADY INCLUDED in the jquery.tablesorter.widgets.js
|
||||||
// file; it is included here to show how you can modify the default classes
|
// file; it is included here to show how you can modify the default classes
|
||||||
$.tablesorter.themes.bootstrap = {
|
$.tablesorter.themes.bootstrap = {
|
||||||
// these classes are added to the table. To see other table classes available,
|
// these classes are added to the table. To see other table classes available,
|
||||||
@ -106,10 +106,10 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// filter button demo code
|
// filter button demo code
|
||||||
$('button.filter').click(function(){
|
$('button.filter').click(function() {
|
||||||
var col = $(this).data('column'),
|
var col = $(this).data('column'),
|
||||||
txt = $(this).data('filter');
|
txt = $(this).data('filter');
|
||||||
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
||||||
@ -118,7 +118,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// toggle zebra widget
|
// toggle zebra widget
|
||||||
$('button.zebra').click(function(){
|
$('button.zebra').click(function() {
|
||||||
var t = $(this).hasClass('btn-success');
|
var t = $(this).hasClass('btn-success');
|
||||||
// if (t) {
|
// if (t) {
|
||||||
// removing classes applied by the zebra widget
|
// removing classes applied by the zebra widget
|
||||||
|
@ -85,10 +85,10 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// filter button demo code
|
// filter button demo code
|
||||||
$('button.filter').click(function(){
|
$('button.filter').click(function() {
|
||||||
var col = $(this).data('column'),
|
var col = $(this).data('column'),
|
||||||
txt = $(this).data('filter');
|
txt = $(this).data('filter');
|
||||||
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
||||||
@ -97,7 +97,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// toggle zebra widget
|
// toggle zebra widget
|
||||||
$('button.zebra').click(function(){
|
$('button.zebra').click(function() {
|
||||||
var t = $(this).hasClass('btn-success');
|
var t = $(this).hasClass('btn-success');
|
||||||
$('table')
|
$('table')
|
||||||
.toggleClass('table-striped')[0]
|
.toggleClass('table-striped')[0]
|
||||||
|
@ -74,10 +74,10 @@ ul { padding-left: 20px; }
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// filter button demo code
|
// filter button demo code
|
||||||
$('button.filter').click(function(){
|
$('button.filter').click(function() {
|
||||||
var col = $(this).data('column'),
|
var col = $(this).data('column'),
|
||||||
txt = $(this).data('filter');
|
txt = $(this).data('filter');
|
||||||
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
$('table').find('.tablesorter-filter').val('').eq(col).val(txt);
|
||||||
@ -86,7 +86,7 @@ ul { padding-left: 20px; }
|
|||||||
});
|
});
|
||||||
|
|
||||||
// toggle zebra widget
|
// toggle zebra widget
|
||||||
$('button.zebra').click(function(){
|
$('button.zebra').click(function() {
|
||||||
var t = $(this).hasClass('green');
|
var t = $(this).hasClass('green');
|
||||||
$('table')
|
$('table')
|
||||||
.toggleClass('striped')[0]
|
.toggleClass('striped')[0]
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}</style>
|
}</style>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$("table")
|
$("table")
|
||||||
.tablesorter({
|
.tablesorter({
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
$("table").tablesorter({
|
$("table").tablesorter({
|
||||||
theme : 'blue',
|
theme : 'blue',
|
||||||
// pass the headers argument and passing a object
|
// pass the headers argument and passing a object
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
$("table").tablesorter({
|
$("table").tablesorter({
|
||||||
theme : 'blue',
|
theme : 'blue',
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('table').on('tablesorter-initialized', function(){
|
$('table').on('tablesorter-initialized', function() {
|
||||||
var i, j, t = [],
|
var i, j, t = [],
|
||||||
cache = this.config.cache[0].normalized;
|
cache = this.config.cache[0].normalized;
|
||||||
for (i = 0; i < cache.length; i++) {
|
for (i = 0; i < cache.length; i++) {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
$("table").tablesorter({
|
$("table").tablesorter({
|
||||||
theme : 'blue',
|
theme : 'blue',
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// BONUS TIP: disable a column using jQuery data directly
|
// BONUS TIP: disable a column using jQuery data directly
|
||||||
// but do it before the table initializes
|
// but do it before the table initializes
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<!-- Tablesorter: optional -->
|
<!-- Tablesorter: optional -->
|
||||||
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// Initialize tablesorter
|
// Initialize tablesorter
|
||||||
// ***********************
|
// ***********************
|
||||||
@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// ajax error callback from $.tablesorter.showError function
|
// ajax error callback from $.tablesorter.showError function
|
||||||
// ajaxError: function( config, xhr, settings, exception ){ return exception; };
|
// ajaxError: function( config, xhr, settings, exception ) { return exception; };
|
||||||
// returning false will abort the error message
|
// returning false will abort the error message
|
||||||
ajaxError: null,
|
ajaxError: null,
|
||||||
|
|
||||||
@ -98,7 +98,7 @@
|
|||||||
// ]
|
// ]
|
||||||
// OR
|
// OR
|
||||||
// return [ total_rows, $rows (jQuery object; optional), headers (array; optional) ]
|
// return [ total_rows, $rows (jQuery object; optional), headers (array; optional) ]
|
||||||
ajaxProcessing: function(data){
|
ajaxProcessing: function(data) {
|
||||||
if (data && data.hasOwnProperty('rows')) {
|
if (data && data.hasOwnProperty('rows')) {
|
||||||
var indx, r, row, c, d = data.rows,
|
var indx, r, row, c, d = data.rows,
|
||||||
// total number of rows (required)
|
// total number of rows (required)
|
||||||
@ -465,11 +465,11 @@ var $url = $('#url');
|
|||||||
$('table')
|
$('table')
|
||||||
|
|
||||||
// show current URL for the DEMO ONLY
|
// show current URL for the DEMO ONLY
|
||||||
.on('changingUrl', function(e, url){
|
.on('changingUrl', function(e, url) {
|
||||||
$url.html(url);
|
$url.html(url);
|
||||||
})
|
})
|
||||||
|
|
||||||
.on('pagerInitialized', function(){
|
.on('pagerInitialized', function() {
|
||||||
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
|
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
|
||||||
// is used as there isn't any way to sort the server side data from the client side.
|
// is used as there isn't any way to sort the server side data from the client side.
|
||||||
this.config.serverSideSorting = false;
|
this.config.serverSideSorting = false;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
||||||
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
var $table = $('table'),
|
var $table = $('table'),
|
||||||
// define pager options
|
// define pager options
|
||||||
@ -64,9 +64,9 @@
|
|||||||
var r, $row, num = 50,
|
var r, $row, num = 50,
|
||||||
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
||||||
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
||||||
$('button:contains(Add)').click(function(){
|
$('button:contains(Add)').click(function() {
|
||||||
// add two rows of random data!
|
// add two rows of random data!
|
||||||
r = row.replace(/\{[gijmr]\}/g, function(m){
|
r = row.replace(/\{[gijmr]\}/g, function(m) {
|
||||||
return {
|
return {
|
||||||
'{i}' : num + 1,
|
'{i}' : num + 1,
|
||||||
'{j}' : num + 2,
|
'{j}' : num + 2,
|
||||||
@ -85,7 +85,7 @@
|
|||||||
|
|
||||||
// Delete a row
|
// Delete a row
|
||||||
// *************
|
// *************
|
||||||
$table.delegate('button.remove', 'click' ,function(){
|
$table.delegate('button.remove', 'click' ,function() {
|
||||||
// NOTE this special treatment is only needed if `removeRows` is `true`
|
// NOTE this special treatment is only needed if `removeRows` is `true`
|
||||||
// disabling the pager will restore all table rows
|
// disabling the pager will restore all table rows
|
||||||
$table.trigger('disablePager');
|
$table.trigger('disablePager');
|
||||||
@ -97,10 +97,10 @@
|
|||||||
|
|
||||||
// Destroy pager / Restore pager
|
// Destroy pager / Restore pager
|
||||||
// **************
|
// **************
|
||||||
$('button:contains(Destroy)').click(function(){
|
$('button:contains(Destroy)').click(function() {
|
||||||
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
||||||
var $t = $(this);
|
var $t = $(this);
|
||||||
if (/Destroy/.test( $t.text() )){
|
if (/Destroy/.test( $t.text() )) {
|
||||||
$table.trigger('destroyPager');
|
$table.trigger('destroyPager');
|
||||||
$t.text('Restore Pager');
|
$t.text('Restore Pager');
|
||||||
} else {
|
} else {
|
||||||
@ -112,14 +112,14 @@
|
|||||||
|
|
||||||
// Disable / Enable
|
// Disable / Enable
|
||||||
// **************
|
// **************
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
var mode = /Disable/.test( $(this).text() );
|
var mode = /Disable/.test( $(this).text() );
|
||||||
// triggering disablePager or enablePager
|
// triggering disablePager or enablePager
|
||||||
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
||||||
$(this).text( ( mode ? 'Enable' : 'Disable' ) + ' Pager');
|
$(this).text( ( mode ? 'Enable' : 'Disable' ) + ' Pager');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$table.bind('pagerChange', function(){
|
$table.bind('pagerChange', function() {
|
||||||
// pager automatically enables when table is sorted.
|
// pager automatically enables when table is sorted.
|
||||||
$('.toggle').text( 'Disable Pager' );
|
$('.toggle').text( 'Disable Pager' );
|
||||||
});
|
});
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
||||||
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// **********************************
|
// **********************************
|
||||||
// Description of ALL pager options
|
// Description of ALL pager options
|
||||||
@ -39,7 +39,7 @@
|
|||||||
customAjaxUrl: function(table, url) { return url; },
|
customAjaxUrl: function(table, url) { return url; },
|
||||||
|
|
||||||
// ajax error callback from $.tablesorter.showError function
|
// ajax error callback from $.tablesorter.showError function
|
||||||
// ajaxError: function( config, xhr, settings, exception ){ return exception; };
|
// ajaxError: function( config, xhr, settings, exception ) { return exception; };
|
||||||
// returning false will abort the error message
|
// returning false will abort the error message
|
||||||
ajaxError: null,
|
ajaxError: null,
|
||||||
|
|
||||||
@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
// bind to pager events
|
// bind to pager events
|
||||||
// *********************
|
// *********************
|
||||||
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c){
|
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) {
|
||||||
var msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
|
var msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
|
||||||
' page <span class="typ">' + (c.page + 1) + '/' + c.totalPages + '</span>';
|
' page <span class="typ">' + (c.page + 1) + '/' + c.totalPages + '</span>';
|
||||||
$('#display')
|
$('#display')
|
||||||
@ -140,9 +140,9 @@
|
|||||||
var r, $row, num = 50,
|
var r, $row, num = 50,
|
||||||
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
||||||
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
||||||
$('button:contains(Add)').click(function(){
|
$('button:contains(Add)').click(function() {
|
||||||
// add two rows of random data!
|
// add two rows of random data!
|
||||||
r = row.replace(/\{[gijmr]\}/g, function(m){
|
r = row.replace(/\{[gijmr]\}/g, function(m) {
|
||||||
return {
|
return {
|
||||||
'{i}' : num + 1,
|
'{i}' : num + 1,
|
||||||
'{j}' : num + 2,
|
'{j}' : num + 2,
|
||||||
@ -161,7 +161,7 @@
|
|||||||
|
|
||||||
// Delete a row
|
// Delete a row
|
||||||
// *************
|
// *************
|
||||||
$('table').delegate('button.remove', 'click' ,function(){
|
$('table').delegate('button.remove', 'click' ,function() {
|
||||||
var t = $('table');
|
var t = $('table');
|
||||||
// disabling the pager will restore all table rows
|
// disabling the pager will restore all table rows
|
||||||
// t.trigger('disablePager');
|
// t.trigger('disablePager');
|
||||||
@ -175,10 +175,10 @@
|
|||||||
|
|
||||||
// Destroy pager / Restore pager
|
// Destroy pager / Restore pager
|
||||||
// **************
|
// **************
|
||||||
$('button:contains(Destroy)').click(function(){
|
$('button:contains(Destroy)').click(function() {
|
||||||
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
||||||
var $t = $(this);
|
var $t = $(this);
|
||||||
if (/Destroy/.test( $t.text() )){
|
if (/Destroy/.test( $t.text() )) {
|
||||||
$('table').trigger('destroyPager');
|
$('table').trigger('destroyPager');
|
||||||
$t.text('Restore Pager');
|
$t.text('Restore Pager');
|
||||||
} else {
|
} else {
|
||||||
@ -190,26 +190,26 @@
|
|||||||
|
|
||||||
// Disable / Enable
|
// Disable / Enable
|
||||||
// **************
|
// **************
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
var mode = /Disable/.test( $(this).text() );
|
var mode = /Disable/.test( $(this).text() );
|
||||||
$('table').trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
$('table').trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
||||||
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
|
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$('table').bind('pagerChange', function(){
|
$('table').bind('pagerChange', function() {
|
||||||
// pager automatically enables when table is sorted.
|
// pager automatically enables when table is sorted.
|
||||||
$('.toggle').text('Disable Pager');
|
$('.toggle').text('Disable Pager');
|
||||||
});
|
});
|
||||||
|
|
||||||
// clear storage (page & size)
|
// clear storage (page & size)
|
||||||
$('.clear-pager-data').click(function(){
|
$('.clear-pager-data').click(function() {
|
||||||
// clears user set page & size from local storage, so on page
|
// clears user set page & size from local storage, so on page
|
||||||
// reload the page & size resets to the original settings
|
// reload the page & size resets to the original settings
|
||||||
$.tablesorter.storage( $('table'), 'tablesorter-pager', '' );
|
$.tablesorter.storage( $('table'), 'tablesorter-pager', '' );
|
||||||
});
|
});
|
||||||
|
|
||||||
// go to page 1 showing 10 rows
|
// go to page 1 showing 10 rows
|
||||||
$('.goto').click(function(){
|
$('.goto').click(function() {
|
||||||
// triggering "pageAndSize" without parameters will reset the
|
// triggering "pageAndSize" without parameters will reset the
|
||||||
// pager to page 1 and the original set size (10 by default)
|
// pager to page 1 and the original set size (10 by default)
|
||||||
// $('table').trigger('pageAndSize')
|
// $('table').trigger('pageAndSize')
|
||||||
@ -218,8 +218,8 @@
|
|||||||
|
|
||||||
});</script>
|
});</script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('.clear').click(function(){
|
$('.clear').click(function() {
|
||||||
$('#display').html( new Array(6).join('<li> </li>') );
|
$('#display').html( new Array(6).join('<li> </li>') );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">// add parser through the tablesorter addParser method
|
<script id="js">// add parser through the tablesorter addParser method
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
$.tablesorter.addParser({
|
$.tablesorter.addParser({
|
||||||
// set a unique id
|
// set a unique id
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
$("table").tablesorter({ theme: 'blue' });
|
$("table").tablesorter({ theme: 'blue' });
|
||||||
});</script>
|
});</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// filter buttons
|
// filter buttons
|
||||||
$('button').on('click', function(){
|
$('button').on('click', function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
filter = [],
|
filter = [],
|
||||||
column = $this.attr('data-column');
|
column = $this.attr('data-column');
|
||||||
|
@ -196,7 +196,7 @@
|
|||||||
.params { font-size: 0.8em; }
|
.params { font-size: 0.8em; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
var tdy = $('.tdy'), // two digit year
|
var tdy = $('.tdy'), // two digit year
|
||||||
a = $('.result'), // answer
|
a = $('.result'), // answer
|
||||||
r = $('.range'), // range
|
r = $('.range'), // range
|
||||||
@ -206,7 +206,7 @@ $(function(){
|
|||||||
tdy.val( (y + 20).toString().slice(-2) ); // use this year + 20
|
tdy.val( (y + 20).toString().slice(-2) ); // use this year + 20
|
||||||
c.val( y );
|
c.val( y );
|
||||||
|
|
||||||
$('input').on('change', function(){
|
$('input').on('change', function() {
|
||||||
var y = parseInt(tdy.val(), 10),
|
var y = parseInt(tdy.val(), 10),
|
||||||
result = 1900 + y,
|
result = 1900 + y,
|
||||||
range = parseInt(r.val(), 10);
|
range = parseInt(r.val(), 10);
|
||||||
|
@ -148,12 +148,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
var $table = $('table'),
|
var $table = $('table'),
|
||||||
len = $table[0].config.durationLength,
|
len = $table[0].config.durationLength,
|
||||||
regex = new RegExp('(\\d{' + len + '})', 'g');
|
regex = new RegExp('(\\d{' + len + '})', 'g');
|
||||||
// add parsed values to order & value column
|
// add parsed values to order & value column
|
||||||
addParsedValues( $table, [1,2], function(v){
|
addParsedValues( $table, [1,2], function(v) {
|
||||||
var t = v.replace(regex, '$1|');
|
var t = v.replace(regex, '$1|');
|
||||||
return t.substring(0, t.length - 1);
|
return t.substring(0, t.length - 1);
|
||||||
});
|
});
|
||||||
|
@ -117,9 +117,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to columns [0,1]
|
// add parsed values to columns [0,1]
|
||||||
addParsedValues($('table'), [0,1], function(num){ return Math.round(num * 100)/100; });
|
addParsedValues($('table'), [0,1], function(num) { return Math.round(num * 100)/100; });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ $.tablesorter.fileTypes.equivalents["Fonts"] += '|svg'; // just add it to the en
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* DEMO ONLY CODE */
|
/* DEMO ONLY CODE */
|
||||||
$(function(){
|
$(function() {
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
$('#media').toggleClass('group-separator-1 group-separator-2');
|
$('#media').toggleClass('group-separator-1 group-separator-2');
|
||||||
$('table').trigger('sorton', [ [[3,0]] ]);
|
$('table').trigger('sorton', [ [[3,0]] ]);
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>If the parser doesn't auto-detect which column has IPv6 addresses, use the headers sorter option to set it:
|
<li>If the parser doesn't auto-detect which column has IPv6 addresses, use the headers sorter option to set it:
|
||||||
<pre class="prettyprint lang-javascript">$(function(){
|
<pre class="prettyprint lang-javascript">$(function() {
|
||||||
$('table').tablesorter({
|
$('table').tablesorter({
|
||||||
headers: {
|
headers: {
|
||||||
1: { sorter: 'MAC' },
|
1: { sorter: 'MAC' },
|
||||||
@ -130,7 +130,7 @@ $(function() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to columns [0,1]
|
// add parsed values to columns [0,1]
|
||||||
addParsedValues($('table'), [1,2,3]);
|
addParsedValues($('table'), [1,2,3]);
|
||||||
});
|
});
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
// set Discount column parser using jQuery data (either 'digit' or 'percent' will work)
|
// set Discount column parser using jQuery data (either 'digit' or 'percent' will work)
|
||||||
$('th.discount').data('sorter', 'digit');
|
$('th.discount').data('sorter', 'digit');
|
||||||
// set an initial sort on the table using jQuery data
|
// set an initial sort on the table using jQuery data
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to columns [0,1]
|
// add parsed values to columns [0,1]
|
||||||
addParsedValues($('table'), [0, 1, 2, 3]);
|
addParsedValues($('table'), [0, 1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
@ -124,9 +124,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to columns [0,1]
|
// add parsed values to columns [0,1]
|
||||||
addParsedValues($('table'), [0,1], function(num){ return num.toExponential(); });
|
addParsedValues($('table'), [0,1], function(num) { return num.toExponential(); });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to columns [0,1]
|
// add parsed values to columns [0,1]
|
||||||
addParsedValues($('table'), [0,1]);
|
addParsedValues($('table'), [0,1]);
|
||||||
});
|
});
|
||||||
|
@ -228,7 +228,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// add parsed values to order & value column
|
// add parsed values to order & value column
|
||||||
addParsedValues($('table'), [0,1,2,3,4]);
|
addParsedValues($('table'), [0,1,2,3,4]);
|
||||||
});
|
});
|
||||||
|
@ -51,13 +51,13 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// sort using data-sort attribute value
|
// sort using data-sort attribute value
|
||||||
$('button[data-sort]').click(function(){
|
$('button[data-sort]').click(function() {
|
||||||
var sort = $(this).data('sort');
|
var sort = $(this).data('sort');
|
||||||
$(this).closest('.block').find('table').trigger('sorton', [ sort ]);
|
$(this).closest('.block').find('table').trigger('sorton', [ sort ]);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.sortReset-toggle').click(function(){
|
$('.sortReset-toggle').click(function() {
|
||||||
var c = $(this).closest('.block').find('table')[0].config;
|
var c = $(this).closest('.block').find('table')[0].config;
|
||||||
c.sortReset = !c.sortReset;
|
c.sortReset = !c.sortReset;
|
||||||
$(this).next().html('' + c.sortReset);
|
$(this).next().html('' + c.sortReset);
|
||||||
@ -74,7 +74,7 @@
|
|||||||
<script>
|
<script>
|
||||||
// demo stuff (update pre with current sort)
|
// demo stuff (update pre with current sort)
|
||||||
$(function() {
|
$(function() {
|
||||||
$('button[data-sort]').click(function(){
|
$('button[data-sort]').click(function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
$box = $this.closest('.box'),
|
$box = $this.closest('.box'),
|
||||||
sort = $this.data('sort'),
|
sort = $this.data('sort'),
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<link rel="stylesheet" href="../css/theme.blue.css">
|
<link rel="stylesheet" href="../css/theme.blue.css">
|
||||||
<script src="../js/jquery.tablesorter.js"></script>
|
<script src="../js/jquery.tablesorter.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
var start;
|
var start;
|
||||||
// call the tablesorter plugin, the magic happens in the markup
|
// call the tablesorter plugin, the magic happens in the markup
|
||||||
@ -29,12 +29,12 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// assign the sortStart event
|
// assign the sortStart event
|
||||||
.bind("sortStart",function(e, t){
|
.bind("sortStart",function(e, t) {
|
||||||
start = e.timeStamp;
|
start = e.timeStamp;
|
||||||
$("#display").append('<li>Sort Started</li>').find('li:first').remove();
|
$("#display").append('<li>Sort Started</li>').find('li:first').remove();
|
||||||
})
|
})
|
||||||
|
|
||||||
.bind("sortEnd",function(e, t){
|
.bind("sortEnd",function(e, t) {
|
||||||
$("#display").append('<li>Sort Ended after ' + ( (e.timeStamp - start)/1000 ).toFixed(2) + ' seconds</li>').find('li:first').remove();
|
$("#display").append('<li>Sort Ended after ' + ( (e.timeStamp - start)/1000 ).toFixed(2) + ' seconds</li>').find('li:first').remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,12 +31,12 @@
|
|||||||
|
|
||||||
// append new html to thead & tbody
|
// append new html to thead & tbody
|
||||||
$("table thead th:eq(2)").html("Age");
|
$("table thead th:eq(2)").html("Age");
|
||||||
$("table tbody").find('td:nth-child(3)').html(function(i,h){
|
$("table tbody").find('td:nth-child(3)').html(function(i,h) {
|
||||||
return h.substring(1); // remove x & y prefix
|
return h.substring(1); // remove x & y prefix
|
||||||
});
|
});
|
||||||
|
|
||||||
var resort = true, // re-apply the current sort
|
var resort = true, // re-apply the current sort
|
||||||
callback = function(){
|
callback = function() {
|
||||||
// do something after the updateAll method has completed
|
// do something after the updateAll method has completed
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
// randomize a number
|
// randomize a number
|
||||||
var resort = "", // resort variable set to anything BUT false (without quotes) will trigger the automatic resort
|
var resort = "", // resort variable set to anything BUT false (without quotes) will trigger the automatic resort
|
||||||
discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2),
|
discount = '$' + Math.round(Math.random() * Math.random() * 100) + '.' + ('0' + Math.round(Math.random() * Math.random() * 100)).slice(-2),
|
||||||
callback = function(table){ /* do something */ };
|
callback = function(table) { /* do something */ };
|
||||||
$(this).text(discount);
|
$(this).text(discount);
|
||||||
|
|
||||||
// set resort flag to false to prevent automatic resort
|
// set resort flag to false to prevent automatic resort
|
||||||
|
@ -391,7 +391,7 @@ td:nth-child(3) .ts-align-right i {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* DEMO ONLY CODE */
|
/* DEMO ONLY CODE */
|
||||||
$(function(){
|
$(function() {
|
||||||
var $table = $('#demo table'),
|
var $table = $('#demo table'),
|
||||||
c = $table[0].config,
|
c = $table[0].config,
|
||||||
$animals = c.$headers.eq(2),
|
$animals = c.$headers.eq(2),
|
||||||
@ -403,7 +403,7 @@ $(function(){
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 3,
|
max: 3,
|
||||||
step: 1,
|
step: 1,
|
||||||
create: function(){
|
create: function() {
|
||||||
$animals.find('span').html( $animals.attr('data-align-index') );
|
$animals.find('span').html( $animals.attr('data-align-index') );
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
@ -419,7 +419,7 @@ $(function(){
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: 4,
|
max: 4,
|
||||||
step: 1,
|
step: 1,
|
||||||
create: function(){
|
create: function() {
|
||||||
$sites.find('span').html( $sites.attr('data-align-index') );
|
$sites.find('span').html( $sites.attr('data-align-index') );
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
@ -435,7 +435,7 @@ $(function(){
|
|||||||
min: -30,
|
min: -30,
|
||||||
max: 30,
|
max: 30,
|
||||||
step: 5,
|
step: 5,
|
||||||
create: function(){
|
create: function() {
|
||||||
$sites.find('span').html( $sites.attr('data-align-index') );
|
$sites.find('span').html( $sites.attr('data-align-index') );
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
|
@ -152,7 +152,7 @@
|
|||||||
Add a function that returns a useable build_type. (e.g. string to array)
|
Add a function that returns a useable build_type. (e.g. string to array)
|
||||||
<div class="collapsible"><br>
|
<div class="collapsible"><br>
|
||||||
The function receives two parameters: <code>data</code> which contains the obtained data and <code>wo</code> which is the widget options (<code>table.config.widgetOptions</code>).<br>
|
The function receives two parameters: <code>data</code> which contains the obtained data and <code>wo</code> which is the widget options (<code>table.config.widgetOptions</code>).<br>
|
||||||
Example: <code>build_processing: function(data, wo){ return data.split(';'); }</code>
|
Example: <code>build_processing: function(data, wo) { return data.split(';'); }</code>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -521,7 +521,7 @@ FusionCharts.ready(function () {
|
|||||||
packages: ["bar", "corechart", "line"]
|
packages: ["bar", "corechart", "line"]
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function(){
|
$(function() {
|
||||||
/* Initial settings */
|
/* Initial settings */
|
||||||
var $table = $('#table'),
|
var $table = $('#table'),
|
||||||
$chart = $('#chart'),
|
$chart = $('#chart'),
|
||||||
@ -629,7 +629,7 @@ $(function(){
|
|||||||
}
|
}
|
||||||
$icons.removeClass('active');
|
$icons.removeClass('active');
|
||||||
var $t = $(this).addClass('active');
|
var $t = $(this).addClass('active');
|
||||||
$.each(types, function(i, v){
|
$.each(types, function(i, v) {
|
||||||
if ($t.hasClass(v.icon)) {
|
if ($t.hasClass(v.icon)) {
|
||||||
settings.type = i;
|
settings.type = i;
|
||||||
}
|
}
|
||||||
@ -637,7 +637,7 @@ $(function(){
|
|||||||
drawChart();
|
drawChart();
|
||||||
});
|
});
|
||||||
|
|
||||||
$rowType.on('change', function(){
|
$rowType.on('change', function() {
|
||||||
$table[0].config.widgetOptions.chart_incRows = $rowType.filter(':checked').attr('data-type');
|
$table[0].config.widgetOptions.chart_incRows = $rowType.filter(':checked').attr('data-type');
|
||||||
// update data, then draw new chart
|
// update data, then draw new chart
|
||||||
$table.trigger('chartData');
|
$table.trigger('chartData');
|
||||||
@ -686,15 +686,14 @@ $(function(){
|
|||||||
pager_output: 'Showing {startRow} to {endRow} of {filteredRows} results',
|
pager_output: 'Showing {startRow} to {endRow} of {filteredRows} results',
|
||||||
pager_size: 5,
|
pager_size: 5,
|
||||||
chart_incRows: 'f',
|
chart_incRows: 'f',
|
||||||
chart_useSelector: true,
|
chart_useSelector: true
|
||||||
chart_hideTable: false
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
// container layout
|
// container layout
|
||||||
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
|
columnSelector_layout : '<label><input type="checkbox">{name}</label>',
|
||||||
// layout customizer callback called for each column
|
// layout customizer callback called for each column
|
||||||
// function($cell, name, column){ return name || $cell.html(); }
|
// function($cell, name, column) { return name || $cell.html(); }
|
||||||
columnSelector_layoutCustomizer : null,
|
columnSelector_layoutCustomizer : null,
|
||||||
// data attribute containing column name to use in the selector container
|
// data attribute containing column name to use in the selector container
|
||||||
columnSelector_name : 'data-selector-name',
|
columnSelector_name : 'data-selector-name',
|
||||||
@ -552,7 +552,7 @@
|
|||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
<p>Bind to this event if you to need to perform an action after the columnSelector has finished hiding or showing columns.</p>
|
<p>Bind to this event if you to need to perform an action after the columnSelector has finished hiding or showing columns.</p>
|
||||||
Use it as follows<pre class="prettyprint lang-js">$('table').on('columnUpdate', function(){
|
Use it as follows<pre class="prettyprint lang-js">$('table').on('columnUpdate', function() {
|
||||||
// set ascending sort on first column
|
// set ascending sort on first column
|
||||||
$(this).trigger('sorton', [ [[0,0]] ]);
|
$(this).trigger('sorton', [ [[0,0]] ]);
|
||||||
});</pre>
|
});</pre>
|
||||||
|
@ -62,7 +62,7 @@ $(function() {
|
|||||||
}
|
}
|
||||||
$('select')
|
$('select')
|
||||||
.html(o)
|
.html(o)
|
||||||
.change(function(){
|
.change(function() {
|
||||||
var theme = $(this).val().toLowerCase();
|
var theme = $(this).val().toLowerCase();
|
||||||
$('table')
|
$('table')
|
||||||
.removeClass('tablesorter-' + t.join(' tablesorter-'))
|
.removeClass('tablesorter-' + t.join(' tablesorter-'))
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
||||||
<script src="../js/widgets/widget-cssStickyHeaders.js"></script>
|
<script src="../js/widgets/widget-cssStickyHeaders.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$('.open-popup-link').magnificPopup({
|
$('.open-popup-link').magnificPopup({
|
||||||
type: 'inline',
|
type: 'inline',
|
||||||
@ -114,7 +114,7 @@
|
|||||||
});</script>
|
});</script>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$('link.theme').each(function(){ this.disabled = true; });
|
$('link.theme').each(function() { this.disabled = true; });
|
||||||
|
|
||||||
var themes = 'default blue green grey ice black-ice dark dropbox',
|
var themes = 'default blue green grey ice black-ice dark dropbox',
|
||||||
i, o = '', t = themes.split(' ');
|
i, o = '', t = themes.split(' ');
|
||||||
@ -124,12 +124,12 @@ $(function() {
|
|||||||
|
|
||||||
$('select:first')
|
$('select:first')
|
||||||
.append(o)
|
.append(o)
|
||||||
.change(function(){
|
.change(function() {
|
||||||
var theme = $(this).val().toLowerCase(),
|
var theme = $(this).val().toLowerCase(),
|
||||||
files = $('link.theme').each(function(){
|
files = $('link.theme').each(function() {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
})
|
})
|
||||||
files.filter('[href$="theme.' + theme + '.css"]').each(function(){
|
files.filter('[href$="theme.' + theme + '.css"]').each(function() {
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
});
|
});
|
||||||
$('table')
|
$('table')
|
||||||
@ -138,10 +138,10 @@ $(function() {
|
|||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
window.addCaption = true;
|
window.addCaption = true;
|
||||||
$('.caption').on('click', function(){
|
$('.caption').on('click', function() {
|
||||||
addCaption = !addCaption;
|
addCaption = !addCaption;
|
||||||
$(this).html( '' + addCaption );
|
$(this).html( '' + addCaption );
|
||||||
$('#table0, #table1, #table2, #table3, .nested').each(function(){
|
$('#table0, #table1, #table2, #table3, .nested').each(function() {
|
||||||
if (this.config) {
|
if (this.config) {
|
||||||
this.config.widgetOptions.cssStickyHeaders_addCaption = addCaption;
|
this.config.widgetOptions.cssStickyHeaders_addCaption = addCaption;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#display li:last-child { color: #008080; }
|
#display li:last-child { color: #008080; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$.tablesorter.currentSortLanguage = {
|
$.tablesorter.currentSortLanguage = {
|
||||||
0: 'asc',
|
0: 'asc',
|
||||||
|
@ -58,7 +58,7 @@ td.editable_updated {
|
|||||||
editable_enterToAccept : true, // press enter to accept content, or click outside if false
|
editable_enterToAccept : true, // press enter to accept content, or click outside if false
|
||||||
editable_autoAccept : true, // accepts any changes made to the table cell automatically (v2.17.6)
|
editable_autoAccept : true, // accepts any changes made to the table cell automatically (v2.17.6)
|
||||||
editable_autoResort : false, // auto resort after the content has changed.
|
editable_autoResort : false, // auto resort after the content has changed.
|
||||||
editable_validate : null, // return a valid string: function(text, original, columnIndex){ return text; }
|
editable_validate : null, // return a valid string: function(text, original, columnIndex) { return text; }
|
||||||
editable_focused : function(txt, columnIndex, $element) {
|
editable_focused : function(txt, columnIndex, $element) {
|
||||||
// $element is the div, not the td
|
// $element is the div, not the td
|
||||||
// to get the td, use $element.closest('td')
|
// to get the td, use $element.closest('td')
|
||||||
@ -69,7 +69,7 @@ td.editable_updated {
|
|||||||
// to get the td, use $element.closest('td')
|
// to get the td, use $element.closest('td')
|
||||||
$element.removeClass('focused');
|
$element.removeClass('focused');
|
||||||
},
|
},
|
||||||
editable_selectAll : function(txt, columnIndex, $element){
|
editable_selectAll : function(txt, columnIndex, $element) {
|
||||||
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
||||||
// only select everthing within the element when the content starts with the letter "B"
|
// only select everthing within the element when the content starts with the letter "B"
|
||||||
return /^b/i.test(txt) && columnIndex === 0;
|
return /^b/i.test(txt) && columnIndex === 0;
|
||||||
@ -81,7 +81,7 @@ td.editable_updated {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// config event variable new in v2.17.6
|
// config event variable new in v2.17.6
|
||||||
.children('tbody').on('editComplete', 'td', function(event, config){
|
.children('tbody').on('editComplete', 'td', function(event, config) {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
newContent = $this.text(),
|
newContent = $this.text(),
|
||||||
cellIndex = this.cellIndex, // there shouldn't be any colspans in the tbody
|
cellIndex = this.cellIndex, // there shouldn't be any colspans in the tbody
|
||||||
@ -90,7 +90,7 @@ td.editable_updated {
|
|||||||
// Do whatever you want here to indicate
|
// Do whatever you want here to indicate
|
||||||
// that the content was updated
|
// that the content was updated
|
||||||
$this.addClass( 'editable_updated' ); // green background + white text
|
$this.addClass( 'editable_updated' ); // green background + white text
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$this.removeClass( 'editable_updated' );
|
$this.removeClass( 'editable_updated' );
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ td.editable_updated {
|
|||||||
<td>Event fired after the table content has been edited
|
<td>Event fired after the table content has been edited
|
||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table')
|
$('#table')
|
||||||
.tablesorter({
|
.tablesorter({
|
||||||
@ -295,7 +295,7 @@ td.editable_updated {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
// use delegated event binding
|
// use delegated event binding
|
||||||
.on('giterdone', 'td', function(event, config){
|
.on('giterdone', 'td', function(event, config) {
|
||||||
// this = td; the event bubble up
|
// this = td; the event bubble up
|
||||||
console.log( 'new content = ' + $(this).text() );
|
console.log( 'new content = ' + $(this).text() );
|
||||||
});
|
});
|
||||||
@ -312,16 +312,16 @@ td.editable_updated {
|
|||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
Set this function to manipulate or adjust the content when the content editable is focused
|
Set this function to manipulate or adjust the content when the content editable is focused
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table').tablesorter({
|
$('#table').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
widgetOptions : {
|
widgetOptions : {
|
||||||
editable_focused : function(txt, columnIndex, $element){
|
editable_focused : function(txt, columnIndex, $element) {
|
||||||
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
||||||
$element.closest('td').addClass('focused');
|
$element.closest('td').addClass('focused');
|
||||||
},
|
},
|
||||||
editable_blur : function(txt, columnIndex, $element){
|
editable_blur : function(txt, columnIndex, $element) {
|
||||||
$element.closest('td').removeClass('focused');
|
$element.closest('td').removeClass('focused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -339,16 +339,16 @@ td.editable_updated {
|
|||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
Set this function to manipulate or adjust the content when the content editable is blurred
|
Set this function to manipulate or adjust the content when the content editable is blurred
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table').tablesorter({
|
$('#table').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
widgetOptions : {
|
widgetOptions : {
|
||||||
editable_focused : function(txt, columnIndex, $element){
|
editable_focused : function(txt, columnIndex, $element) {
|
||||||
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
||||||
$element.closest('td').addClass('focused');
|
$element.closest('td').addClass('focused');
|
||||||
},
|
},
|
||||||
editable_blur : function(txt, columnIndex, $element){
|
editable_blur : function(txt, columnIndex, $element) {
|
||||||
$element.closest('td').removeClass('focused');
|
$element.closest('td').removeClass('focused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,12 +371,12 @@ td.editable_updated {
|
|||||||
<li>When <code>false</code>, no selection is made.</li>
|
<li>When <code>false</code>, no selection is made.</li>
|
||||||
<li>When this option contains a function, return either <code>true</code> to select all of the text within the element, or <code>false</code> to not select any text.</li>
|
<li>When this option contains a function, return either <code>true</code> to select all of the text within the element, or <code>false</code> to not select any text.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table').tablesorter({
|
$('#table').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
widgetOptions : {
|
widgetOptions : {
|
||||||
editable_selectAll : function(txt, columnIndex, $element){
|
editable_selectAll : function(txt, columnIndex, $element) {
|
||||||
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
// note $element is the div inside of the table cell, so use $element.closest('td') to get the cell
|
||||||
// only select everthing within the element when the content starts with the letter "B"
|
// only select everthing within the element when the content starts with the letter "B"
|
||||||
return /^b/i.test(txt) && columnIndex === 0;
|
return /^b/i.test(txt) && columnIndex === 0;
|
||||||
@ -404,13 +404,13 @@ td.editable_updated {
|
|||||||
<li>A <code>$element</code> parameter has been included which contains the contenteditable element. To get the table cell, use <code>$element.closest('td');</code></li>
|
<li>A <code>$element</code> parameter has been included which contains the contenteditable element. To get the table cell, use <code>$element.closest('td');</code></li>
|
||||||
</ul>
|
</ul>
|
||||||
This function must return either a string containing the modified content or <code>false</code> to revert the content back to it's original value. Example:
|
This function must return either a string containing the modified content or <code>false</code> to revert the content back to it's original value. Example:
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table1').tablesorter({
|
$('#table1').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
widgetOptions : {
|
widgetOptions : {
|
||||||
// global validate function
|
// global validate function
|
||||||
editable_validate : function(txt, orig, columnIndex, $element){
|
editable_validate : function(txt, orig, columnIndex, $element) {
|
||||||
// only allow one word
|
// only allow one word
|
||||||
var t = /\s/.test(txt) ? txt.split(/\s/)[0] : txt;
|
var t = /\s/.test(txt) ? txt.split(/\s/)[0] : txt;
|
||||||
return t || false;
|
return t || false;
|
||||||
@ -423,7 +423,7 @@ td.editable_updated {
|
|||||||
widgetOptions : {
|
widgetOptions : {
|
||||||
// validate function per column
|
// validate function per column
|
||||||
editable_validate : {
|
editable_validate : {
|
||||||
0 : function(txt, orig, columnIndex, $element){
|
0 : function(txt, orig, columnIndex, $element) {
|
||||||
// allow up to two words
|
// allow up to two words
|
||||||
var t = txt.split(' ');
|
var t = txt.split(' ');
|
||||||
return t.length > 2 ? t[0] + (t[1] ? ' ' + t[1] : '') : txt;
|
return t.length > 2 ? t[0] + (t[1] ? ' ' + t[1] : '') : txt;
|
||||||
@ -455,7 +455,7 @@ td.editable_updated {
|
|||||||
If this option is <code>true</code>, this widget will trim content <em>upon initialization</em>; this is necessary if you need cleaned it up content before editing, like with an autocomplete script.<br>
|
If this option is <code>true</code>, this widget will trim content <em>upon initialization</em>; this is necessary if you need cleaned it up content before editing, like with an autocomplete script.<br>
|
||||||
<br>
|
<br>
|
||||||
Use this option as follows:
|
Use this option as follows:
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table').tablesorter({
|
$('#table').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
@ -482,7 +482,7 @@ td.editable_updated {
|
|||||||
<li>If the cell already has children (one or more) immediately inside of the table cell, no wrapping occurs and the child element(s) that don't have the class name set in <code>editable_noEdit</code>, will have the "contenteditable" attribute enabled.</li>
|
<li>If the cell already has children (one or more) immediately inside of the table cell, no wrapping occurs and the child element(s) that don't have the class name set in <code>editable_noEdit</code>, will have the "contenteditable" attribute enabled.</li>
|
||||||
</ul>
|
</ul>
|
||||||
Note: that this option uses jQuery's <code>wrapInner</code>, so this option can be set to a html string or selector, jQuery object, DOM element, or a function (jQuery 1.4+)
|
Note: that this option uses jQuery's <code>wrapInner</code>, so this option can be set to a html string or selector, jQuery object, DOM element, or a function (jQuery 1.4+)
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
$('#table').tablesorter({
|
$('#table').tablesorter({
|
||||||
widgets : ['editable'],
|
widgets : ['editable'],
|
||||||
@ -583,11 +583,11 @@ td.editable_updated {
|
|||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
var wo = $('#table')[0].config.widgetOptions;
|
var wo = $('#table')[0].config.widgetOptions;
|
||||||
$('.enter').click(function(){
|
$('.enter').click(function() {
|
||||||
var t = wo.editable_enterToAccept = !wo.editable_enterToAccept;
|
var t = wo.editable_enterToAccept = !wo.editable_enterToAccept;
|
||||||
$(this).next().find('span').html('' + t);
|
$(this).next().find('span').html('' + t);
|
||||||
});
|
});
|
||||||
$('.auto').click(function(){
|
$('.auto').click(function() {
|
||||||
var t = wo.editable_autoAccept = !wo.editable_autoAccept;
|
var t = wo.editable_autoAccept = !wo.editable_autoAccept;
|
||||||
$(this).next().find('span').html('' + t);
|
$(this).next().find('span').html('' + t);
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// make demo search buttons work
|
// make demo search buttons work
|
||||||
$('button[data-column]').on('click', function(){
|
$('button[data-column]').on('click', function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
totalColumns = $table[0].config.columns,
|
totalColumns = $table[0].config.columns,
|
||||||
col = $this.data('column'), // zero-based index or "all"
|
col = $this.data('column'), // zero-based index or "all"
|
||||||
|
@ -99,7 +99,7 @@ tr.group-header.collapsed td i {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
var wo = $table[0].config.widgetOptions,
|
var wo = $table[0].config.widgetOptions,
|
||||||
set = !wo.filter_childWithSibs;
|
set = !wo.filter_childWithSibs;
|
||||||
wo.filter_childWithSibs = set;
|
wo.filter_childWithSibs = set;
|
||||||
@ -108,7 +108,7 @@ tr.group-header.collapsed td i {
|
|||||||
$table.trigger( 'search', false );
|
$table.trigger( 'search', false );
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.search').click(function(){
|
$('.search').click(function() {
|
||||||
var filter = [],
|
var filter = [],
|
||||||
$this = $(this),
|
$this = $(this),
|
||||||
col = parseInt( $this.attr('data-column'), 10 );
|
col = parseInt( $this.attr('data-column'), 10 );
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#types { width: 100%; }
|
#types { width: 100%; }
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#types').tablesorter();
|
$('#types').tablesorter();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -70,7 +70,7 @@ $(function() {
|
|||||||
// External search
|
// External search
|
||||||
// buttons set up like this:
|
// buttons set up like this:
|
||||||
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
var $t = $(this),
|
var $t = $(this),
|
||||||
col = $t.data('filter-column'), // zero-based index
|
col = $t.data('filter-column'), // zero-based index
|
||||||
filter = [];
|
filter = [];
|
||||||
@ -211,7 +211,7 @@ $.tablesorter.filter.types.start = function( config, data ) {
|
|||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>If one of the built-in search types is interfering or bothersome to your users, then you can remove it using the following command (using fuzzy search as an example):
|
<li>If one of the built-in search types is interfering or bothersome to your users, then you can remove it using the following command (using fuzzy search as an example):
|
||||||
<pre class="prettyprint lang-js">$(function(){
|
<pre class="prettyprint lang-js">$(function() {
|
||||||
|
|
||||||
// Remove fuzzy search
|
// Remove fuzzy search
|
||||||
delete $.tablesorter.filter.types.fuzzy;
|
delete $.tablesorter.filter.types.fuzzy;
|
||||||
|
@ -44,8 +44,8 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('button').on('click', function(){
|
$('button').on('click', function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
filters = [],
|
filters = [],
|
||||||
col = $(this).data('column'),
|
col = $(this).data('column'),
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
<script src="../js/widgets/widget-filter.js"></script>
|
<script src="../js/widgets/widget-filter.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// External search
|
// External search
|
||||||
// buttons set up like this:
|
// buttons set up like this:
|
||||||
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
// <button type="button" class="search" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
||||||
$('button.match').click(function(){
|
$('button.match').click(function() {
|
||||||
|
|
||||||
// toggle "filter-match" class on first column
|
// toggle "filter-match" class on first column
|
||||||
var first = $('table').find('th:first').toggleClass('filter-match');
|
var first = $('table').find('th:first').toggleClass('filter-match');
|
||||||
@ -44,7 +44,7 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.accordion button[data-filter-column]').click(function(){
|
$('.accordion button[data-filter-column]').click(function() {
|
||||||
var filters = [],
|
var filters = [],
|
||||||
$t = $(this),
|
$t = $(this),
|
||||||
col = $t.data('filter-column'), // zero-based index
|
col = $t.data('filter-column'), // zero-based index
|
||||||
@ -54,7 +54,7 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.search-type').click(function(){
|
$('button.search-type').click(function() {
|
||||||
var c = $('#demo table')[0].config,
|
var c = $('#demo table')[0].config,
|
||||||
wo = c.widgetOptions,
|
wo = c.widgetOptions,
|
||||||
search = wo.filter_searchFiltered = !wo.filter_searchFiltered;
|
search = wo.filter_searchFiltered = !wo.filter_searchFiltered;
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Allow changing an input from one column (any column) to another
|
// Allow changing an input from one column (any column) to another
|
||||||
$('select').change(function(){
|
$('select').change(function() {
|
||||||
// modify the search input data-column value (swap "0" or "all in this demo)
|
// modify the search input data-column value (swap "0" or "all in this demo)
|
||||||
$('.selectable').attr( 'data-column', $(this).val() );
|
$('.selectable').attr( 'data-column', $(this).val() );
|
||||||
// update external search inputs
|
// update external search inputs
|
||||||
|
@ -39,19 +39,19 @@
|
|||||||
<script src="../js/widgets/widget-uitheme.js"></script>
|
<script src="../js/widgets/widget-uitheme.js"></script>
|
||||||
<script src="../js/widgets/widget-filter-formatter-jui.js"></script>
|
<script src="../js/widgets/widget-filter-formatter-jui.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
$('#switcher').jui_theme_switch({
|
$('#switcher').jui_theme_switch({
|
||||||
stylesheet_link_id : 'ui-theme',
|
stylesheet_link_id : 'ui-theme',
|
||||||
datasource_url : 'assets/theme_switcher.json'
|
datasource_url : 'assets/theme_switcher.json'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.accordion button').on('click', function(){
|
$('.accordion button').on('click', function() {
|
||||||
var $this = $(this),
|
var $this = $(this),
|
||||||
column = $this.data('column'),
|
column = $this.data('column'),
|
||||||
filters = [];
|
filters = [];
|
||||||
filters[ column ] = $this.data('value');
|
filters[ column ] = $this.data('value');
|
||||||
$('table').trigger('sorton', [ [[column, 0]], function(){
|
$('table').trigger('sorton', [ [[column, 0]], function() {
|
||||||
$.tablesorter.setFilters( $('table'), filters, true );
|
$.tablesorter.setFilters( $('table'), filters, true );
|
||||||
} ]);
|
} ]);
|
||||||
});
|
});
|
||||||
@ -77,7 +77,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Rank (jQuery selector added v2.17.0)
|
// Rank (jQuery selector added v2.17.0)
|
||||||
'th:contains("Rank")' : function($cell, indx){
|
'th:contains("Rank")' : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
||||||
delayed : true,
|
delayed : true,
|
||||||
valueToHeader : false,
|
valueToHeader : false,
|
||||||
@ -92,7 +92,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Age
|
// Age
|
||||||
1 : function($cell, indx){
|
1 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
||||||
delayed : false,
|
delayed : false,
|
||||||
valueToHeader : false,
|
valueToHeader : false,
|
||||||
@ -108,7 +108,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Total (jQuery selector added v2.17.0)
|
// Total (jQuery selector added v2.17.0)
|
||||||
'.total' : function($cell, indx){
|
'.total' : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
|
||||||
delayed : false,
|
delayed : false,
|
||||||
valueToHeader : false,
|
valueToHeader : false,
|
||||||
@ -120,7 +120,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Discount
|
// Discount
|
||||||
3 : function($cell, indx){
|
3 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
|
||||||
delayed : true,
|
delayed : true,
|
||||||
addToggle : false,
|
addToggle : false,
|
||||||
@ -136,7 +136,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Date (one input)
|
// Date (one input)
|
||||||
4 : function($cell, indx){
|
4 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
|
||||||
cellText : 'Dates', // text added before the input
|
cellText : 'Dates', // text added before the input
|
||||||
compare : [ '', '=', '>=', '<=' ],
|
compare : [ '', '=', '>=', '<=' ],
|
||||||
@ -150,7 +150,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Date (two inputs)
|
// Date (two inputs)
|
||||||
5 : function($cell, indx){
|
5 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
|
||||||
// from : '08/01/2013', // default from date
|
// from : '08/01/2013', // default from date
|
||||||
// to : '1/18/2014', // default to date
|
// to : '1/18/2014', // default to date
|
||||||
@ -266,7 +266,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Rank (jQuery selector added v2.17.0)
|
// Rank (jQuery selector added v2.17.0)
|
||||||
'th:contains("Rank")' : function($cell, indx){
|
'th:contains("Rank")' : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
||||||
// filterFormatter options
|
// filterFormatter options
|
||||||
cellText : 'Rank:',
|
cellText : 'Rank:',
|
||||||
@ -285,7 +285,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Age
|
// Age
|
||||||
1 : function($cell, indx){
|
1 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSlider( $cell, indx, {
|
||||||
delayed: false, // delay search (set by filter_searchDelay)
|
delayed: false, // delay search (set by filter_searchDelay)
|
||||||
valueToHeader: false, // add current slider value to the header cell
|
valueToHeader: false, // add current slider value to the header cell
|
||||||
@ -334,7 +334,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Total column (jQuery selector added v2.17.0)
|
// Total column (jQuery selector added v2.17.0)
|
||||||
'.total' : function($cell, indx){
|
'.total' : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiRange( $cell, indx, {
|
||||||
delayed: true, // delay search (set by filter_searchDelay)
|
delayed: true, // delay search (set by filter_searchDelay)
|
||||||
valueToHeader: false, // add current slider value to the header cell
|
valueToHeader: false, // add current slider value to the header cell
|
||||||
@ -378,7 +378,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Discount column
|
// Discount column
|
||||||
3 : function($cell, indx){
|
3 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiSpinner( $cell, indx, {
|
||||||
delayed: true, // delay search (set by filter_searchDelay)
|
delayed: true, // delay search (set by filter_searchDelay)
|
||||||
addToggle: false, // add a toggle switch to activate/deactive the search
|
addToggle: false, // add a toggle switch to activate/deactive the search
|
||||||
@ -433,7 +433,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Date (one input)
|
// Date (one input)
|
||||||
4 : function($cell, indx){
|
4 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiDateCompare( $cell, indx, {
|
||||||
cellText : 'Dates', // text added before the input
|
cellText : 'Dates', // text added before the input
|
||||||
compare : [ '', '=', '>=', '<=' ], // search values greater/less than selected value; overrides exactMatch
|
compare : [ '', '=', '>=', '<=' ], // search values greater/less than selected value; overrides exactMatch
|
||||||
@ -496,7 +496,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Date (two inputs)
|
// Date (two inputs)
|
||||||
5 : function($cell, indx){
|
5 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
|
return $.tablesorter.filterFormatter.uiDatepicker( $cell, indx, {
|
||||||
// add any of the jQuery UI Datepicker options here (http://api.jqueryui.com/datepicker/)
|
// add any of the jQuery UI Datepicker options here (http://api.jqueryui.com/datepicker/)
|
||||||
// from : '8/1/2013', // starting date
|
// from : '8/1/2013', // starting date
|
||||||
@ -543,10 +543,10 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>Some method should be added to show the user the current value of the selector - update a data attribute for css3 tooltips, or update the header cell.</li>
|
<li>Some method should be added to show the user the current value of the selector - update a data attribute for css3 tooltips, or update the header cell.</li>
|
||||||
<li>A reset function needs to also be included; bind to the <code>filterReset</code> event and clear out or disable your custom selector when triggered.
|
<li>A reset function needs to also be included; bind to the <code>filterReset</code> event and clear out or disable your custom selector when triggered.
|
||||||
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterReset', function(){ /* update the input here */ });</pre>
|
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterReset', function() { /* update the input here */ });</pre>
|
||||||
</li>
|
</li>
|
||||||
<li>In <span class="version">v2.15.0</span>, in order to update your custom input with any saved filter searches, you will need to bind to the <code>filterFomatterUpdate</code> event to get the saved filter value from the hidden input and apply it to your custom input.
|
<li>In <span class="version">v2.15.0</span>, in order to update your custom input with any saved filter searches, you will need to bind to the <code>filterFomatterUpdate</code> event to get the saved filter value from the hidden input and apply it to your custom input.
|
||||||
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterFomatterUpdate', function(){
|
<pre class="prettyprint lang-javascript">$cell.closest('table').bind('filterFomatterUpdate', function() {
|
||||||
var savedSearch = $cell.find('input[type=hidden]').val();
|
var savedSearch = $cell.find('input[type=hidden]').val();
|
||||||
// apply this saved search to your custom input
|
// apply this saved search to your custom input
|
||||||
$.tablesorter.filter.formatterUpdated($cell, indx); // new v2.17.5
|
$.tablesorter.filter.formatterUpdated($cell, indx); // new v2.17.5
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Rank
|
// Rank
|
||||||
0 : function($cell, indx){
|
0 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
||||||
value: 0,
|
value: 0,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -55,7 +55,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
1 : function($cell, indx){
|
1 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
|
||||||
value: '#000000',
|
value: '#000000',
|
||||||
addToggle: true,
|
addToggle: true,
|
||||||
@ -65,7 +65,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Age
|
// Age
|
||||||
3: function($cell, indx){
|
3: function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
||||||
value: 1,
|
value: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -78,7 +78,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
4 : function($cell, indx){
|
4 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
||||||
value: 0,
|
value: 0,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -90,7 +90,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Discount
|
// Discount
|
||||||
5: function($cell, indx){
|
5: function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
||||||
value: 1,
|
value: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -155,7 +155,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Rank
|
// Rank
|
||||||
0 : function($cell, indx){
|
0 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
||||||
value: 0,
|
value: 0,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -168,7 +168,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Total
|
// Total
|
||||||
4 : function($cell, indx){
|
4 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Range( $cell, indx, {
|
||||||
value: 0,
|
value: 0,
|
||||||
min: 0,
|
min: 0,
|
||||||
@ -212,7 +212,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
1 : function($cell, indx){
|
1 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Color( $cell, indx, {
|
||||||
value: '#000000',
|
value: '#000000',
|
||||||
addToggle: true,
|
addToggle: true,
|
||||||
@ -254,7 +254,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Age
|
// Age
|
||||||
3: function($cell, indx){
|
3: function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
||||||
value: 1,
|
value: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
@ -267,7 +267,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Discount
|
// Discount
|
||||||
5: function($cell, indx){
|
5: function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
return $.tablesorter.filterFormatter.html5Number( $cell, indx, {
|
||||||
value: 1,
|
value: 1,
|
||||||
min: 1,
|
min: 1,
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<script src="js/select2-3.4.6.min.js"></script>
|
<script src="js/select2-3.4.6.min.js"></script>
|
||||||
<script src="../js/widgets/widget-filter-formatter-select2.js"></script>
|
<script src="../js/widgets/widget-filter-formatter-select2.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$('.tablesorter').tablesorter({
|
$('.tablesorter').tablesorter({
|
||||||
theme: 'blue',
|
theme: 'blue',
|
||||||
@ -40,7 +40,7 @@
|
|||||||
filter_formatter : {
|
filter_formatter : {
|
||||||
|
|
||||||
// Alphanumeric (match)
|
// Alphanumeric (match)
|
||||||
0 : function($cell, indx){
|
0 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
||||||
match : true, // adds "filter-match" to header
|
match : true, // adds "filter-match" to header
|
||||||
cellText : 'Match: ', // Cell text
|
cellText : 'Match: ', // Cell text
|
||||||
@ -50,7 +50,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Alphanumeric (exact)
|
// Alphanumeric (exact)
|
||||||
1 : function($cell, indx){
|
1 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
||||||
match : false // exact match only
|
match : false // exact match only
|
||||||
});
|
});
|
||||||
@ -153,7 +153,7 @@
|
|||||||
This is an example of how to set these options:
|
This is an example of how to set these options:
|
||||||
<pre class="prettyprint lang-js">filter_formatter : {
|
<pre class="prettyprint lang-js">filter_formatter : {
|
||||||
// default settings on first column
|
// default settings on first column
|
||||||
0 : function($cell, indx){
|
0 : function($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
return $.tablesorter.filterFormatter.select2( $cell, indx, {
|
||||||
// *** select2 filter formatter options ***
|
// *** select2 filter formatter options ***
|
||||||
cellText : '', // Text (wrapped in a label element)
|
cellText : '', // Text (wrapped in a label element)
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
$table
|
$table
|
||||||
.find( '.' + selectmenuClass )
|
.find( '.' + selectmenuClass )
|
||||||
.iconselectmenu({
|
.iconselectmenu({
|
||||||
change: function(){
|
change: function() {
|
||||||
// start a new search
|
// start a new search
|
||||||
$table.trigger( 'search' );
|
$table.trigger( 'search' );
|
||||||
}
|
}
|
||||||
|
@ -163,12 +163,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Clear stored filters - added v2.25.6
|
// Clear stored filters - added v2.25.6
|
||||||
$('.resetsaved').click(function(){
|
$('.resetsaved').click(function() {
|
||||||
$('#table').trigger('filterResetSaved');
|
$('#table').trigger('filterResetSaved');
|
||||||
|
|
||||||
// show quick popup to indicate something happened
|
// show quick popup to indicate something happened
|
||||||
var $message = $('<span class="results"> Reset</span>').insertAfter(this);
|
var $message = $('<span class="results"> Reset</span>').insertAfter(this);
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
$message.remove();
|
$message.remove();
|
||||||
}, 500);
|
}, 500);
|
||||||
return false;
|
return false;
|
||||||
@ -177,7 +177,7 @@
|
|||||||
// External search
|
// External search
|
||||||
// buttons set up like this:
|
// buttons set up like this:
|
||||||
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
||||||
$('button[data-filter-column]').click(function(){
|
$('button[data-filter-column]').click(function() {
|
||||||
/*** first method *** data-filter-column="1" data-filter-text="!son"
|
/*** first method *** data-filter-column="1" data-filter-text="!son"
|
||||||
add search value to Discount column (zero based index) input */
|
add search value to Discount column (zero based index) input */
|
||||||
var filters = [],
|
var filters = [],
|
||||||
@ -211,10 +211,10 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
|
|
||||||
// *** widgetfilter_startsWith toggle button ***
|
// *** widgetfilter_startsWith toggle button ***
|
||||||
$('button.toggle').click(function(){
|
$('button.toggle').click(function() {
|
||||||
var c = $('#table')[0].config,
|
var c = $('#table')[0].config,
|
||||||
$t = $(this),
|
$t = $(this),
|
||||||
// toggle the boolean
|
// toggle the boolean
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
// tweak "Added" column to keep recent dates
|
// tweak "Added" column to keep recent dates
|
||||||
$(function(){
|
$(function() {
|
||||||
var d, t,
|
var d, t,
|
||||||
tweaks = [ 9e5, 8e8, 2e7, 0, 6e10, 1e11 ],
|
tweaks = [ 9e5, 8e8, 2e7, 0, 6e10, 1e11 ],
|
||||||
$t = $('#demo tbody'),
|
$t = $('#demo tbody'),
|
||||||
date = new Date().getTime();
|
date = new Date().getTime();
|
||||||
$t.find('tr td:nth-child(4)').each(function(i){
|
$t.find('tr td:nth-child(4)').each(function(i) {
|
||||||
d = new Date( date - tweaks[i] );
|
d = new Date( date - tweaks[i] );
|
||||||
t = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear() + ' ' +
|
t = (d.getMonth() + 1) + '/' + d.getDate() + '/' + d.getFullYear() + ' ' +
|
||||||
d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
|
d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
|
||||||
@ -88,7 +88,7 @@
|
|||||||
* Copyright (c) 2011 John Resig (ejohn.org)
|
* Copyright (c) 2011 John Resig (ejohn.org)
|
||||||
* Licensed under the MIT and GPL licenses.
|
* Licensed under the MIT and GPL licenses.
|
||||||
*/
|
*/
|
||||||
function prettyDate(date){
|
function prettyDate(date) {
|
||||||
var diff = (((new Date()).getTime() - date.getTime()) / 1000),
|
var diff = (((new Date()).getTime() - date.getTime()) / 1000),
|
||||||
day_diff = Math.floor(diff / 86400);
|
day_diff = Math.floor(diff / 86400);
|
||||||
if ( isNaN(day_diff) || day_diff < 0 ) { return ''; }
|
if ( isNaN(day_diff) || day_diff < 0 ) { return ''; }
|
||||||
|
@ -81,7 +81,7 @@ tr.group-header.collapsed td i {
|
|||||||
<!-- grouping widget -->
|
<!-- grouping widget -->
|
||||||
<script src="../js/widgets/widget-grouping.js"></script>
|
<script src="../js/widgets/widget-grouping.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$("table").tablesorter({
|
$("table").tablesorter({
|
||||||
theme : 'blue',
|
theme : 'blue',
|
||||||
@ -97,7 +97,7 @@ tr.group-header.collapsed td i {
|
|||||||
|
|
||||||
$('.tablesorter-childRow td').hide();
|
$('.tablesorter-childRow td').hide();
|
||||||
|
|
||||||
$('.tablesorter').on('click', '.toggle', function(){
|
$('.tablesorter').on('click', '.toggle', function() {
|
||||||
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').find('td').toggle();
|
$(this).closest('tr').nextUntil('tr:not(.tablesorter-childRow)').find('td').toggle();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
@ -73,7 +73,7 @@ tr.group-header.collapsed td i {
|
|||||||
<script src="../js/widgets/widget-grouping.js"></script>
|
<script src="../js/widgets/widget-grouping.js"></script>
|
||||||
<script src="../js/widgets/widget-storage.js"></script>
|
<script src="../js/widgets/widget-storage.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$("#groups").tablesorter({
|
$("#groups").tablesorter({
|
||||||
theme : "blue",
|
theme : "blue",
|
||||||
@ -135,7 +135,7 @@ tr.group-header.collapsed td i {
|
|||||||
// column = current column being sorted/grouped
|
// column = current column being sorted/grouped
|
||||||
if (column === 2) {
|
if (column === 2) {
|
||||||
var subtotal = 0;
|
var subtotal = 0;
|
||||||
$rows.each(function(){
|
$rows.each(function() {
|
||||||
subtotal += parseFloat( $(this).find("td").eq(column).text() );
|
subtotal += parseFloat( $(this).find("td").eq(column).text() );
|
||||||
});
|
});
|
||||||
$cell.find(".group-count").append("; subtotal: " + subtotal );
|
$cell.find(".group-count").append("; subtotal: " + subtotal );
|
||||||
@ -349,7 +349,7 @@ group_separator : /[/.]/</pre>
|
|||||||
<li><code>column</code> - current table column being grouped (zero-based index).</li>
|
<li><code>column</code> - current table column being grouped (zero-based index).</li>
|
||||||
<li><code>table</code> - current table (DOM).</li>
|
<li><code>table</code> - current table (DOM).</li>
|
||||||
</ul>
|
</ul>
|
||||||
<pre class="prettyprint lang-js">group_callback : function($cell, $rows, column, table){
|
<pre class="prettyprint lang-js">group_callback : function($cell, $rows, column, table) {
|
||||||
$cell.find('.group-name').append(' group'); // adds "group" to the end of the group name
|
$cell.find('.group-name').append(' group'); // adds "group" to the end of the group name
|
||||||
}</pre>
|
}</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -361,7 +361,7 @@ group_separator : /[/.]/</pre>
|
|||||||
<td>
|
<td>
|
||||||
Event triggered on the table when the grouping widget has finished work <span class="version">v2.12</span>.
|
Event triggered on the table when the grouping widget has finished work <span class="version">v2.12</span>.
|
||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<pre class="prettyprint lang-js">$('table').on('groupingComplete', function(){
|
<pre class="prettyprint lang-js">$('table').on('groupingComplete', function() {
|
||||||
// always hide empty groups ("Empty" can be added by the group_formatter function)
|
// always hide empty groups ("Empty" can be added by the group_formatter function)
|
||||||
$(this).find('.group-header:contains("Empty")').trigger('toggleGroup');
|
$(this).find('.group-header:contains("Empty")').trigger('toggleGroup');
|
||||||
});</pre>
|
});</pre>
|
||||||
@ -613,7 +613,7 @@ group_dateString : function(date, config, $header ) {
|
|||||||
Target the group header(s) and trigger a "toggleGroup" event to show/hide rows associated with that group.
|
Target the group header(s) and trigger a "toggleGroup" event to show/hide rows associated with that group.
|
||||||
|
|
||||||
<pre class="prettyprint lang-js">// "toggle" class name added to a button/link
|
<pre class="prettyprint lang-js">// "toggle" class name added to a button/link
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
// show/hide all groups - table must be grouped (sorted or force grouping)
|
// show/hide all groups - table must be grouped (sorted or force grouping)
|
||||||
$('table').find('.group-header').trigger('toggleGroup');
|
$('table').find('.group-header').trigger('toggleGroup');
|
||||||
return false;
|
return false;
|
||||||
@ -886,7 +886,7 @@ $(function() {
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* DEMO ONLY CODE */
|
/* DEMO ONLY CODE */
|
||||||
$(function(){
|
$(function() {
|
||||||
var $groups = $('#groups'),
|
var $groups = $('#groups'),
|
||||||
startBlock = 10,
|
startBlock = 10,
|
||||||
startVal = 1,
|
startVal = 1,
|
||||||
@ -901,13 +901,13 @@ $(function() {
|
|||||||
min: 10,
|
min: 10,
|
||||||
max: 50,
|
max: 50,
|
||||||
step: 10,
|
step: 10,
|
||||||
create: function(){
|
create: function() {
|
||||||
$('.numberclass').html(' "group-number-' + startBlock + '"');
|
$('.numberclass').html(' "group-number-' + startBlock + '"');
|
||||||
$groups.find('.tablesorter-header-inner:eq(' + numcol + ')').find('span').html(startBlock);
|
$groups.find('.tablesorter-header-inner:eq(' + numcol + ')').find('span').html(startBlock);
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
$groups[0].config.$headers.eq(numcol)
|
$groups[0].config.$headers.eq(numcol)
|
||||||
.attr('class', function(i,v){
|
.attr('class', function(i,v) {
|
||||||
return v.replace(/group-number-\d+/, 'group-number-' + ui.value);
|
return v.replace(/group-number-\d+/, 'group-number-' + ui.value);
|
||||||
})
|
})
|
||||||
.trigger('sorton', [ [[numcol,0]] ]);
|
.trigger('sorton', [ [[numcol,0]] ]);
|
||||||
@ -921,13 +921,13 @@ $(function() {
|
|||||||
min: 1,
|
min: 1,
|
||||||
max: 5,
|
max: 5,
|
||||||
step: 1,
|
step: 1,
|
||||||
create: function(){
|
create: function() {
|
||||||
$('.animalclass').html(' "group-letter-' + startVal + '"');
|
$('.animalclass').html(' "group-letter-' + startVal + '"');
|
||||||
$groups.find('.tablesorter-header-inner:eq(' + letcol + ')').find('span').html(startVal === 1 ? 'letter' : startVal + ' letters');
|
$groups.find('.tablesorter-header-inner:eq(' + letcol + ')').find('span').html(startVal === 1 ? 'letter' : startVal + ' letters');
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
$groups[0].config.$headers.eq(letcol)
|
$groups[0].config.$headers.eq(letcol)
|
||||||
.attr('class', function(i,v){
|
.attr('class', function(i,v) {
|
||||||
return v.replace(/group-letter-\d+/, 'group-letter-' + ui.value);
|
return v.replace(/group-letter-\d+/, 'group-letter-' + ui.value);
|
||||||
})
|
})
|
||||||
.trigger('sorton', [ [[letcol,0]] ]);
|
.trigger('sorton', [ [[letcol,0]] ]);
|
||||||
@ -941,13 +941,13 @@ $(function() {
|
|||||||
min: 0,
|
min: 0,
|
||||||
max: dateGroups.length - 1,
|
max: dateGroups.length - 1,
|
||||||
step: 1,
|
step: 1,
|
||||||
create: function(){
|
create: function() {
|
||||||
$('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"');
|
$('.dateclass').html(' "group-date' + (curGroup > 0 ? '-' + dateGroups[curGroup] : '') + '"');
|
||||||
$groups.find('.tablesorter-header-inner:eq(' + datecol + ')').find('span').html(curGroup === 0 ? 'full' : dateGroups[curGroup]);
|
$groups.find('.tablesorter-header-inner:eq(' + datecol + ')').find('span').html(curGroup === 0 ? 'full' : dateGroups[curGroup]);
|
||||||
},
|
},
|
||||||
slide: function( event, ui ) {
|
slide: function( event, ui ) {
|
||||||
var $h = $groups[0].config.$headers.eq(datecol)
|
var $h = $groups[0].config.$headers.eq(datecol)
|
||||||
.attr('class', function(i,v){
|
.attr('class', function(i,v) {
|
||||||
return v.replace(/group-date(-\w+)?/, 'group-date' + (ui.value > 0 ? '-' + dateGroups[ui.value] : ''));
|
return v.replace(/group-date(-\w+)?/, 'group-date' + (ui.value > 0 ? '-' + dateGroups[ui.value] : ''));
|
||||||
});
|
});
|
||||||
$h.removeClass('sorter-weekday-index sorter-time');
|
$h.removeClass('sorter-weekday-index sorter-time');
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
$table1 = $('#table1'),
|
$table1 = $('#table1'),
|
||||||
// first table only
|
// first table only
|
||||||
wo = $table1[0].config.widgetOptions;
|
wo = $table1[0].config.widgetOptions;
|
||||||
$('button').on('click', function(){
|
$('button').on('click', function() {
|
||||||
wo.headerTitle_useAria = !wo.headerTitle_useAria;
|
wo.headerTitle_useAria = !wo.headerTitle_useAria;
|
||||||
// show current state in demo
|
// show current state in demo
|
||||||
$state.text( wo.headerTitle_useAria );
|
$state.text( wo.headerTitle_useAria );
|
||||||
|
@ -84,7 +84,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
|
|||||||
});
|
});
|
||||||
|
|
||||||
// preset searches for the first table
|
// preset searches for the first table
|
||||||
$('button[data-filter-column]').click(function(){
|
$('button[data-filter-column]').click(function() {
|
||||||
var filters = [],
|
var filters = [],
|
||||||
config = $table[0].config,
|
config = $table[0].config,
|
||||||
$t = $(this),
|
$t = $(this),
|
||||||
@ -115,7 +115,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
|
|||||||
});
|
});
|
||||||
|
|
||||||
// preset searches on the second table
|
// preset searches on the second table
|
||||||
$('button.table2').click(function(){
|
$('button.table2').click(function() {
|
||||||
// check for reset
|
// check for reset
|
||||||
var query = $(this).hasClass('reset2') ? '' : this.textContent;
|
var query = $(this).hasClass('reset2') ? '' : this.textContent;
|
||||||
config = $table2[0].config;
|
config = $table2[0].config;
|
||||||
@ -229,7 +229,7 @@ th.tablesorter-header.ignore, .ignore { background-color: #e6bf99; }
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button.update').click(function(){
|
$('button.update').click(function() {
|
||||||
// update the marks in the table
|
// update the marks in the table
|
||||||
$('table').trigger('markFu');
|
$('table').trigger('markFu');
|
||||||
});</pre>
|
});</pre>
|
||||||
@ -322,12 +322,12 @@ $('button.update').click(function(){
|
|||||||
</tr>
|
</tr>
|
||||||
<tr id="mark-each">
|
<tr id="mark-each">
|
||||||
<td><span class="permalink">mark_each</span></td>
|
<td><span class="permalink">mark_each</span></td>
|
||||||
<td>function(element){}</td>
|
<td>function(element) {}</td>
|
||||||
<td>A callback for each marked element.</td>
|
<td>A callback for each marked element.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="mark-filter">
|
<tr id="mark-filter">
|
||||||
<td><a href="#" class="permalink">mark_filter</a></td>
|
<td><a href="#" class="permalink">mark_filter</a></td>
|
||||||
<td>function(parameters){ return true; }</td>
|
<td>function(parameters) { return true; }</td>
|
||||||
<td>A callback to filter or limit matches.
|
<td>A callback to filter or limit matches.
|
||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
@ -342,7 +342,7 @@ $('button.update').click(function(){
|
|||||||
</tr>
|
</tr>
|
||||||
<tr id="mark-nomatch">
|
<tr id="mark-nomatch">
|
||||||
<td><a href="#" class="permalink">mark_noMatch</a></td>
|
<td><a href="#" class="permalink">mark_noMatch</a></td>
|
||||||
<td>function(keyword){}</td>
|
<td>function(keyword) {}</td>
|
||||||
<td>A callback function that will be called when there are no matches.
|
<td>A callback function that will be called when there are no matches.
|
||||||
<div class="collapsible">
|
<div class="collapsible">
|
||||||
<br>
|
<br>
|
||||||
@ -354,7 +354,7 @@ $('button.update').click(function(){
|
|||||||
</tr>
|
</tr>
|
||||||
<tr id="mark-done">
|
<tr id="mark-done">
|
||||||
<td><span class="permalink">mark_done</span></td>
|
<td><span class="permalink">mark_done</span></td>
|
||||||
<td>function(totalMatches){}</td>
|
<td>function(totalMatches) {}</td>
|
||||||
<td>A callback function after all marks are done.</td>
|
<td>A callback function after all marks are done.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="mark-debug">
|
<tr id="mark-debug">
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
$('.resultz').html(results.join('<br>'));
|
$('.resultz').html(results.join('<br>'));
|
||||||
};
|
};
|
||||||
|
|
||||||
$(function(){
|
$(function() {
|
||||||
$('button').click(function () {
|
$('button').click(function () {
|
||||||
process();
|
process();
|
||||||
});
|
});
|
||||||
@ -145,7 +145,7 @@
|
|||||||
$.tablesorter.equations['product'] = function(arry) {
|
$.tablesorter.equations['product'] = function(arry) {
|
||||||
// multiple all array values together
|
// multiple all array values together
|
||||||
var product = 1;
|
var product = 1;
|
||||||
$.each(arry, function(i,v){
|
$.each(arry, function(i,v) {
|
||||||
// oops, we shouldn't have any zero values in the array
|
// oops, we shouldn't have any zero values in the array
|
||||||
if (v !== 0) {
|
if (v !== 0) {
|
||||||
product *= v;
|
product *= v;
|
||||||
@ -407,7 +407,7 @@ math_complete : function($cell, wo, result, value, arry) {
|
|||||||
<br>
|
<br>
|
||||||
Use this option as follows:
|
Use this option as follows:
|
||||||
<pre class="prettyprint lang-js">// complete executed after each function
|
<pre class="prettyprint lang-js">// complete executed after each function
|
||||||
math_complete : function($cell, wo, result, value, arry){
|
math_complete : function($cell, wo, result, value, arry) {
|
||||||
return '$ ' + result + $cell.attr('data-suffix');
|
return '$ ' + result + $cell.attr('data-suffix');
|
||||||
}</pre>
|
}</pre>
|
||||||
<ul>
|
<ul>
|
||||||
@ -420,7 +420,7 @@ math_complete : function($cell, wo, result, value, arry){
|
|||||||
In this function, if a anything is returned, it will be automatically added to the <code>$cell</code> as html. Or, return <code>false</code> and no change is made to the cell contents; use this method if you manipulate the <code>$cell</code> contents and don't want the widget to do it.<br>
|
In this function, if a anything is returned, it will be automatically added to the <code>$cell</code> as html. Or, return <code>false</code> and no change is made to the cell contents; use this method if you manipulate the <code>$cell</code> contents and don't want the widget to do it.<br>
|
||||||
<br>
|
<br>
|
||||||
If you need to format the data output after manipulating the <code>value</code>, you can use <code>wo.math_mask</code>, or a different mask, by using the <code>$.tablesorter.formatMask( mask, value );</code> function. For example:
|
If you need to format the data output after manipulating the <code>value</code>, you can use <code>wo.math_mask</code>, or a different mask, by using the <code>$.tablesorter.formatMask( mask, value );</code> function. For example:
|
||||||
<pre class="prettyprint lang-js">math_complete : function($cell, wo, result, value, arry){
|
<pre class="prettyprint lang-js">math_complete : function($cell, wo, result, value, arry) {
|
||||||
var percent = Math.round( value * 1e4 ) / 100; // percent with two decimal places
|
var percent = Math.round( value * 1e4 ) / 100; // percent with two decimal places
|
||||||
return $.tablesorter.formatMask( wo.math_mask, percent ) + ' %';
|
return $.tablesorter.formatMask( wo.math_mask, percent ) + ' %';
|
||||||
}</pre>
|
}</pre>
|
||||||
@ -593,7 +593,7 @@ math_rowFilter : ':visible:not(.filtered)'</pre>
|
|||||||
$.tablesorter.equations['product'] = function(arry, config) {
|
$.tablesorter.equations['product'] = function(arry, config) {
|
||||||
// multiple all array values together
|
// multiple all array values together
|
||||||
var product = 1;
|
var product = 1;
|
||||||
$.each(arry, function(i,v){
|
$.each(arry, function(i,v) {
|
||||||
// oops, we shouldn't have any zero values in the array
|
// oops, we shouldn't have any zero values in the array
|
||||||
if (v !== 0) {
|
if (v !== 0) {
|
||||||
product *= v;
|
product *= v;
|
||||||
|
@ -79,7 +79,7 @@ table.tablesorter tbody tr.even.checked td {
|
|||||||
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
||||||
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
<script src="../addons/pager/jquery.tablesorter.pager.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#output-options').tablesorter({
|
$('#output-options').tablesorter({
|
||||||
theme: 'bootstrap',
|
theme: 'bootstrap',
|
||||||
widthFixed : true,
|
widthFixed : true,
|
||||||
@ -90,7 +90,7 @@ table.tablesorter tbody tr.even.checked td {
|
|||||||
// External search
|
// External search
|
||||||
// buttons set up like this:
|
// buttons set up like this:
|
||||||
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
// <button type="button" data-filter-column="4" data-filter-text="2?%">Saved Search</button>
|
||||||
$('button[data-filter-column]').click(function(){
|
$('button[data-filter-column]').click(function() {
|
||||||
/*** first method *** data-filter-column="2" data-filter-text="!son"
|
/*** first method *** data-filter-column="2" data-filter-text="!son"
|
||||||
add search value to Discount column (zero based index) input */
|
add search value to Discount column (zero based index) input */
|
||||||
var filters = [],
|
var filters = [],
|
||||||
@ -177,21 +177,21 @@ table.tablesorter tbody tr.even.checked td {
|
|||||||
// set up download buttons for two table groups
|
// set up download buttons for two table groups
|
||||||
var demos = ['.group1', '.group2'];
|
var demos = ['.group1', '.group2'];
|
||||||
|
|
||||||
$.each(demos, function(groupIndex){
|
$.each(demos, function(groupIndex) {
|
||||||
var $this = $(demos[groupIndex]);
|
var $this = $(demos[groupIndex]);
|
||||||
|
|
||||||
$this.find('.dropdown-toggle').click(function(e){
|
$this.find('.dropdown-toggle').click(function(e) {
|
||||||
// this is needed because clicking inside the dropdown will close
|
// this is needed because clicking inside the dropdown will close
|
||||||
// the menu with only bootstrap controlling it.
|
// the menu with only bootstrap controlling it.
|
||||||
$this.find('.dropdown-menu').toggle();
|
$this.find('.dropdown-menu').toggle();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
// make separator & replace quotes buttons update the value
|
// make separator & replace quotes buttons update the value
|
||||||
$this.find('.output-separator').click(function(){
|
$this.find('.output-separator').click(function() {
|
||||||
$this.find('.output-separator').removeClass('active');
|
$this.find('.output-separator').removeClass('active');
|
||||||
var txt = $(this).addClass('active').html();
|
var txt = $(this).addClass('active').html();
|
||||||
$this.find('.output-separator-input').val( txt );
|
$this.find('.output-separator-input').val( txt );
|
||||||
$this.find('.output-filename').val(function(i, v){
|
$this.find('.output-filename').val(function(i, v) {
|
||||||
// change filename extension based on separator
|
// change filename extension based on separator
|
||||||
var filetype = (txt === 'json' || txt === 'array') ? 'js' :
|
var filetype = (txt === 'json' || txt === 'array') ? 'js' :
|
||||||
txt === ',' ? 'csv' : 'txt';
|
txt === ',' ? 'csv' : 'txt';
|
||||||
@ -199,18 +199,18 @@ table.tablesorter tbody tr.even.checked td {
|
|||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$this.find('.output-quotes').click(function(){
|
$this.find('.output-quotes').click(function() {
|
||||||
$this.find('.output-quotes').removeClass('active');
|
$this.find('.output-quotes').removeClass('active');
|
||||||
$this.find('.output-replacequotes').val( $(this).addClass('active').text() );
|
$this.find('.output-replacequotes').val( $(this).addClass('active').text() );
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
// header/footer toggle buttons
|
// header/footer toggle buttons
|
||||||
$this.find('.output-header, .output-footer').click(function(){
|
$this.find('.output-header, .output-footer').click(function() {
|
||||||
$(this).toggleClass('active');
|
$(this).toggleClass('active');
|
||||||
});
|
});
|
||||||
// clicking the download button; all you really need is to
|
// clicking the download button; all you really need is to
|
||||||
// trigger an "output" event on the table
|
// trigger an "output" event on the table
|
||||||
$this.find('.download').click(function(){
|
$this.find('.download').click(function() {
|
||||||
var typ,
|
var typ,
|
||||||
$table = $this.find('table'),
|
$table = $this.find('table'),
|
||||||
wo = $table[0].config.widgetOptions,
|
wo = $table[0].config.widgetOptions,
|
||||||
@ -406,7 +406,7 @@ table.tablesorter tbody tr.even.checked td {
|
|||||||
<pre class="prettyprint lang-js">$(function () {
|
<pre class="prettyprint lang-js">$(function () {
|
||||||
var $table = $('table');
|
var $table = $('table');
|
||||||
|
|
||||||
$('.download').click(function(){
|
$('.download').click(function() {
|
||||||
// tell the output widget do it's thing
|
// tell the output widget do it's thing
|
||||||
$table.trigger('outputTable');
|
$table.trigger('outputTable');
|
||||||
});
|
});
|
||||||
@ -847,7 +847,7 @@ line,value1,value2,value3
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
Default setting:
|
Default setting:
|
||||||
<pre class="prettyprint lang-js">function(config, data, url){
|
<pre class="prettyprint lang-js">function(config, data, url) {
|
||||||
// return data.replace( /Mary Smith/g, 'Mary Smith-Jones' ); // v2.25.1+
|
// return data.replace( /Mary Smith/g, 'Mary Smith-Jones' ); // v2.25.1+
|
||||||
return true;
|
return true;
|
||||||
}</pre>
|
}</pre>
|
||||||
@ -864,7 +864,7 @@ line,value1,value2,value3
|
|||||||
// entire table using the current filters, sort, etc.
|
// entire table using the current filters, sort, etc.
|
||||||
if (url) {
|
if (url) {
|
||||||
return $.getJSON(url + "&csv=1")
|
return $.getJSON(url + "&csv=1")
|
||||||
.done(function(data){
|
.done(function(data) {
|
||||||
return data.csv;
|
return data.csv;
|
||||||
})
|
})
|
||||||
.fail(function() {
|
.fail(function() {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<!-- Tablesorter: optional -->
|
<!-- Tablesorter: optional -->
|
||||||
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
<script src="../js/jquery.tablesorter.widgets.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
// Initialize tablesorter
|
// Initialize tablesorter
|
||||||
// ***********************
|
// ***********************
|
||||||
@ -116,7 +116,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// ajax error callback from $.tablesorter.showError function
|
// ajax error callback from $.tablesorter.showError function
|
||||||
// pager_ajaxError: function( config, xhr, settings, exception ){ return exception; };
|
// pager_ajaxError: function( config, xhr, settings, exception ) { return exception; };
|
||||||
// returning false will abort the error message
|
// returning false will abort the error message
|
||||||
pager_ajaxError: null,
|
pager_ajaxError: null,
|
||||||
|
|
||||||
@ -151,7 +151,7 @@
|
|||||||
// ],
|
// ],
|
||||||
// [ "header1", "header2", ... "headerN" ] // optional
|
// [ "header1", "header2", ... "headerN" ] // optional
|
||||||
// ]
|
// ]
|
||||||
pager_ajaxProcessing: function(data){
|
pager_ajaxProcessing: function(data) {
|
||||||
if (data && data.hasOwnProperty('rows')) {
|
if (data && data.hasOwnProperty('rows')) {
|
||||||
var indx, r, row, c, d = data.rows,
|
var indx, r, row, c, d = data.rows,
|
||||||
// total number of rows (required)
|
// total number of rows (required)
|
||||||
@ -400,11 +400,11 @@ var $url = $('#url');
|
|||||||
$('table')
|
$('table')
|
||||||
|
|
||||||
// show current URL for the DEMO ONLY
|
// show current URL for the DEMO ONLY
|
||||||
.on('changingUrl', function(e, url){
|
.on('changingUrl', function(e, url) {
|
||||||
$url.html(url);
|
$url.html(url);
|
||||||
})
|
})
|
||||||
|
|
||||||
.on('pagerInitialized', function(){
|
.on('pagerInitialized', function() {
|
||||||
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
|
// allow THIS demo to sort the content; this variable is automatically set to true when ajax
|
||||||
// is used as there isn't any way to sort the server side data from the client side.
|
// is used as there isn't any way to sort the server side data from the client side.
|
||||||
this.config.serverSideSorting = false;
|
this.config.serverSideSorting = false;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
<link rel="stylesheet" href="../addons/pager/jquery.tablesorter.pager.css">
|
||||||
<script src="../js/widgets/widget-pager.js"></script>
|
<script src="../js/widgets/widget-pager.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
var $table = $('table');
|
var $table = $('table');
|
||||||
|
|
||||||
@ -103,7 +103,7 @@
|
|||||||
|
|
||||||
// bind to pager events
|
// bind to pager events
|
||||||
// *********************
|
// *********************
|
||||||
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c){
|
.bind('pagerChange pagerComplete pagerInitialized pageMoved', function(e, c) {
|
||||||
var p = c.pager, // NEW with the widget... it returns config, instead of config.pager
|
var p = c.pager, // NEW with the widget... it returns config, instead of config.pager
|
||||||
msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
|
msg = '"</span> event triggered, ' + (e.type === 'pagerChange' ? 'going to' : 'now on') +
|
||||||
' page <span class="typ">' + (p.page + 1) + '/' + p.totalPages + '</span>';
|
' page <span class="typ">' + (p.page + 1) + '/' + p.totalPages + '</span>';
|
||||||
@ -119,9 +119,9 @@
|
|||||||
var r, $row, num = 50,
|
var r, $row, num = 50,
|
||||||
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
row = '<tr><td>Student{i}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>' +
|
||||||
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
'<tr><td>Student{j}</td><td>{m}</td><td>{g}</td><td>{r}</td><td>{r}</td><td>{r}</td><td>{r}</td><td><button type="button" class="remove" title="Remove this row">X</button></td></tr>';
|
||||||
$('button:contains(Add)').click(function(){
|
$('button:contains(Add)').click(function() {
|
||||||
// add two rows of random data!
|
// add two rows of random data!
|
||||||
r = row.replace(/\{[gijmr]\}/g, function(m){
|
r = row.replace(/\{[gijmr]\}/g, function(m) {
|
||||||
return {
|
return {
|
||||||
'{i}' : num + 1,
|
'{i}' : num + 1,
|
||||||
'{j}' : num + 2,
|
'{j}' : num + 2,
|
||||||
@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
// Delete a row
|
// Delete a row
|
||||||
// *************
|
// *************
|
||||||
$table.delegate('button.remove', 'click' ,function(){
|
$table.delegate('button.remove', 'click' ,function() {
|
||||||
// disabling the pager will restore all table rows
|
// disabling the pager will restore all table rows
|
||||||
// $table.trigger('disablePager');
|
// $table.trigger('disablePager');
|
||||||
// remove chosen row
|
// remove chosen row
|
||||||
@ -153,10 +153,10 @@
|
|||||||
|
|
||||||
// Destroy pager / Restore pager
|
// Destroy pager / Restore pager
|
||||||
// **************
|
// **************
|
||||||
$('button:contains(Destroy)').click(function(){
|
$('button:contains(Destroy)').click(function() {
|
||||||
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
// Exterminate, annhilate, destroy! http://www.youtube.com/watch?v=LOqn8FxuyFs
|
||||||
var $t = $(this);
|
var $t = $(this);
|
||||||
if (/Destroy/.test( $t.text() )){
|
if (/Destroy/.test( $t.text() )) {
|
||||||
$table.trigger('destroyPager');
|
$table.trigger('destroyPager');
|
||||||
$t.text('Restore Pager');
|
$t.text('Restore Pager');
|
||||||
} else {
|
} else {
|
||||||
@ -168,27 +168,27 @@
|
|||||||
|
|
||||||
// Disable / Enable
|
// Disable / Enable
|
||||||
// **************
|
// **************
|
||||||
$('.toggle').click(function(){
|
$('.toggle').click(function() {
|
||||||
var mode = /Disable/.test( $(this).text() );
|
var mode = /Disable/.test( $(this).text() );
|
||||||
// using disablePager or enablePager
|
// using disablePager or enablePager
|
||||||
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
$table.trigger( (mode ? 'disable' : 'enable') + 'Pager');
|
||||||
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
|
$(this).text( (mode ? 'Enable' : 'Disable') + 'Pager');
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
$table.bind('pagerChange', function(){
|
$table.bind('pagerChange', function() {
|
||||||
// pager automatically enables when table is sorted.
|
// pager automatically enables when table is sorted.
|
||||||
$('.toggle').text('Disable Pager');
|
$('.toggle').text('Disable Pager');
|
||||||
});
|
});
|
||||||
|
|
||||||
// clear storage (page & size)
|
// clear storage (page & size)
|
||||||
$('.clear-pager-data').click(function(){
|
$('.clear-pager-data').click(function() {
|
||||||
// clears user set page & size from local storage, so on page
|
// clears user set page & size from local storage, so on page
|
||||||
// reload the page & size resets to the original settings
|
// reload the page & size resets to the original settings
|
||||||
$.tablesorter.storage( $table, 'tablesorter-pager', '' );
|
$.tablesorter.storage( $table, 'tablesorter-pager', '' );
|
||||||
});
|
});
|
||||||
|
|
||||||
// go to page 1 showing 10 rows
|
// go to page 1 showing 10 rows
|
||||||
$('.goto').click(function(){
|
$('.goto').click(function() {
|
||||||
// triggering "pageAndSize" without parameters will reset the
|
// triggering "pageAndSize" without parameters will reset the
|
||||||
// pager to page 1 and the original set size (10 by default)
|
// pager to page 1 and the original set size (10 by default)
|
||||||
// $('table').trigger('pageAndSize')
|
// $('table').trigger('pageAndSize')
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
print_styleSheet : '../css/theme.blue.css', // add the url of your print stylesheet
|
print_styleSheet : '../css/theme.blue.css', // add the url of your print stylesheet
|
||||||
print_now : true, // Open the print dialog immediately if true
|
print_now : true, // Open the print dialog immediately if true
|
||||||
// callback executed when processing completes - default setting is null
|
// callback executed when processing completes - default setting is null
|
||||||
print_callback : function(config, $table, printStyle){
|
print_callback : function(config, $table, printStyle) {
|
||||||
// do something to the $table (jQuery object of table wrapped in a div)
|
// do something to the $table (jQuery object of table wrapped in a div)
|
||||||
// or add to the printStyle string, then...
|
// or add to the printStyle string, then...
|
||||||
// print the table using the following code
|
// print the table using the following code
|
||||||
@ -100,7 +100,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.print').click(function(){
|
$('.print').click(function() {
|
||||||
$('.tablesorter').trigger('printTable');
|
$('.tablesorter').trigger('printTable');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ print_callback : function( config, $table, printStyle ) {
|
|||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>To make the print widget work programmatically, trigger a "printTable" event.
|
<li>To make the print widget work programmatically, trigger a "printTable" event.
|
||||||
<pre class="prettyprint lang-js">$('.print').click(function(){
|
<pre class="prettyprint lang-js">$('.print').click(function() {
|
||||||
$('.tablesorter').trigger('printTable');
|
$('.tablesorter').trigger('printTable');
|
||||||
});</pre>
|
});</pre>
|
||||||
</li>
|
</li>
|
||||||
|
@ -186,7 +186,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<script src="../js/widgets/widget-reflow.js"></script>
|
<script src="../js/widgets/widget-reflow.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
// screen size class names
|
// screen size class names
|
||||||
var j = 0,
|
var j = 0,
|
||||||
allClasses = '',
|
allClasses = '',
|
||||||
@ -199,7 +199,7 @@
|
|||||||
[ 'smart-p', 'smartphone portrait 320x480' ]
|
[ 'smart-p', 'smartphone portrait 320x480' ]
|
||||||
];
|
];
|
||||||
$('.resize-frame li')
|
$('.resize-frame li')
|
||||||
.each(function(i){
|
.each(function(i) {
|
||||||
// add tooltip to each table size button
|
// add tooltip to each table size button
|
||||||
$(this).attr('title', sizes[j][1]);
|
$(this).attr('title', sizes[j][1]);
|
||||||
j = (j + 1) % 6;
|
j = (j + 1) % 6;
|
||||||
@ -207,14 +207,14 @@
|
|||||||
allClasses += sizes[i][0] + ' ';
|
allClasses += sizes[i][0] + ' ';
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('click', function(){
|
.on('click', function() {
|
||||||
var $t = $(this),
|
var $t = $(this),
|
||||||
indx = $t.index();
|
indx = $t.index();
|
||||||
$t.addClass('active').siblings().removeClass('active');
|
$t.addClass('active').siblings().removeClass('active');
|
||||||
$t.parent().nextAll('div:first').removeClass(allClasses).addClass( sizes[indx][0] );
|
$t.parent().nextAll('div:first').removeClass(allClasses).addClass( sizes[indx][0] );
|
||||||
});
|
});
|
||||||
// toggle thead in iframe
|
// toggle thead in iframe
|
||||||
$('button.toggle').click(function(){
|
$('button.toggle').click(function() {
|
||||||
$(this).nextAll('div:first').find('iframe').contents().find('thead').toggleClass('hide-header');
|
$(this).nextAll('div:first').find('iframe').contents().find('thead').toggleClass('hide-header');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<script src="../js/widgets/widget-reflow.js"></script>
|
<script src="../js/widgets/widget-reflow.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#table1').resizable({
|
$('#table1').resizable({
|
||||||
handles : 'e'
|
handles : 'e'
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
$('table')
|
$('table')
|
||||||
.trigger('saveSortReset') // clear saved sort
|
.trigger('saveSortReset') // clear saved sort
|
||||||
.trigger("sortReset"); // reset current table sort
|
.trigger("sortReset"); // reset current table sort
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<script src="js/jquery.jui_theme_switch.min.js"></script>
|
<script src="js/jquery.jui_theme_switch.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#switcher').jui_theme_switch({
|
$('#switcher').jui_theme_switch({
|
||||||
stylesheet_link_id : 'ui-theme',
|
stylesheet_link_id : 'ui-theme',
|
||||||
switcher_label : 'Select jQuery UI Theme:',
|
switcher_label : 'Select jQuery UI Theme:',
|
||||||
@ -89,7 +89,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$('.tablesorter').tablesorter({
|
$('.tablesorter').tablesorter({
|
||||||
theme: 'jui',
|
theme: 'jui',
|
||||||
@ -168,7 +168,7 @@ $(function() {
|
|||||||
$('#theme')
|
$('#theme')
|
||||||
.append(o)
|
.append(o)
|
||||||
.val('jui')
|
.val('jui')
|
||||||
.change(function(){
|
.change(function() {
|
||||||
var theme = $(this).val().toLowerCase();
|
var theme = $(this).val().toLowerCase();
|
||||||
|
|
||||||
// show jui select only if jQuery UI selected
|
// show jui select only if jQuery UI selected
|
||||||
@ -177,7 +177,7 @@ $(function() {
|
|||||||
$('#main').attr( 'class', 'using-' + theme + '-theme' );
|
$('#main').attr( 'class', 'using-' + theme + '-theme' );
|
||||||
|
|
||||||
// refresh uitheme widget class names
|
// refresh uitheme widget class names
|
||||||
$('#main .tablesorter').each(function(){
|
$('#main .tablesorter').each(function() {
|
||||||
if (this.config) {
|
if (this.config) {
|
||||||
this.config.theme = theme === 'black-ice' ? 'blackice' : theme;
|
this.config.theme = theme === 'black-ice' ? 'blackice' : theme;
|
||||||
}
|
}
|
||||||
@ -188,7 +188,7 @@ $(function() {
|
|||||||
$(window).trigger('resize');
|
$(window).trigger('resize');
|
||||||
}).change();
|
}).change();
|
||||||
|
|
||||||
$('button').click(function(){
|
$('button').click(function() {
|
||||||
var jth = $jth.text() === 'true',
|
var jth = $jth.text() === 'true',
|
||||||
uas = $uas.text() === 'true';
|
uas = $uas.text() === 'true';
|
||||||
if (this.id === 'jthb') {
|
if (this.id === 'jthb') {
|
||||||
@ -196,7 +196,7 @@ $(function() {
|
|||||||
} else {
|
} else {
|
||||||
uas = !uas;
|
uas = !uas;
|
||||||
}
|
}
|
||||||
$('.tablesorter-scroller-table table').each(function(){
|
$('.tablesorter-scroller-table table').each(function() {
|
||||||
var c = this.config;
|
var c = this.config;
|
||||||
if (c) {
|
if (c) {
|
||||||
c.widgetOptions.scroller_jumpToHeader = jth;
|
c.widgetOptions.scroller_jumpToHeader = jth;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
widgets: ['zebra', 'staticRow']
|
widgets: ['zebra', 'staticRow']
|
||||||
})
|
})
|
||||||
// (ctrl or mac command) + click to toggle static row
|
// (ctrl or mac command) + click to toggle static row
|
||||||
.find('tbody tr').click(function(event){
|
.find('tbody tr').click(function(event) {
|
||||||
if (event.ctrlKey || event.metaKey) {
|
if (event.ctrlKey || event.metaKey) {
|
||||||
$(this)
|
$(this)
|
||||||
.toggleClass('static')
|
.toggleClass('static')
|
||||||
@ -51,14 +51,14 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.addrow').click(function(){
|
$('.addrow').click(function() {
|
||||||
$('#alphimals tbody')
|
$('#alphimals tbody')
|
||||||
.append('<tr><td>AA</td><td>0</td><td>Aardvark</td></tr>')
|
.append('<tr><td>AA</td><td>0</td><td>Aardvark</td></tr>')
|
||||||
.trigger('update');
|
.trigger('update');
|
||||||
});
|
});
|
||||||
|
|
||||||
// move row up or down
|
// move row up or down
|
||||||
$('.move').click(function(){
|
$('.move').click(function() {
|
||||||
var direction = $(this).hasClass('up'),
|
var direction = $(this).hasClass('up'),
|
||||||
$rows = $('#alphimals tr'),
|
$rows = $('#alphimals tr'),
|
||||||
$ig = $rows.filter(':contains(Iguana)').addClass('static'),
|
$ig = $rows.filter(':contains(Iguana)').addClass('static'),
|
||||||
@ -179,7 +179,7 @@ $(table).trigger('staticRowsRefresh');</pre>
|
|||||||
this allows moving a static row dynamically; try the Move "Ignuana" row buttons above the "Single tbody" demo.
|
this allows moving a static row dynamically; try the Move "Ignuana" row buttons above the "Single tbody" demo.
|
||||||
<h3>Event</h3>
|
<h3>Event</h3>
|
||||||
A <code>staticRowsComplete</code> event is triggered after the static rows widget has completed moving the static rows back into place. Use it as follows:
|
A <code>staticRowsComplete</code> event is triggered after the static rows widget has completed moving the static rows back into place. Use it as follows:
|
||||||
<pre class="prettyprint lang-js">$(table).bind('staticRowsComplete', function(table){
|
<pre class="prettyprint lang-js">$(table).bind('staticRowsComplete', function(table) {
|
||||||
console.log('static rows applied to ' + table.id);
|
console.log('static rows applied to ' + table.id);
|
||||||
});</pre>
|
});</pre>
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,7 +61,7 @@ Note:
|
|||||||
<script src="../js/widgets/widget-filter.js"></script>
|
<script src="../js/widgets/widget-filter.js"></script>
|
||||||
<script src="../js/widgets/widget-stickyHeaders.js"></script>
|
<script src="../js/widgets/widget-stickyHeaders.js"></script>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
|
|
||||||
$('.open-popup-link').magnificPopup({
|
$('.open-popup-link').magnificPopup({
|
||||||
type: 'inline',
|
type: 'inline',
|
||||||
@ -145,10 +145,10 @@ Note:
|
|||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
window.includeCaption = true;
|
window.includeCaption = true;
|
||||||
$('.caption').on('click', function(){
|
$('.caption').on('click', function() {
|
||||||
includeCaption = !includeCaption;
|
includeCaption = !includeCaption;
|
||||||
$(this).html( '' + includeCaption );
|
$(this).html( '' + includeCaption );
|
||||||
$('#table0, #table1, #table2, #table3, .nested').each(function(){
|
$('#table0, #table1, #table2, #table3, .nested').each(function() {
|
||||||
if (this.config) {
|
if (this.config) {
|
||||||
this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
|
this.config.widgetOptions.stickyHeaders_includeCaption = includeCaption;
|
||||||
this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
|
this.config.widgetOptions.$sticky.children('caption').toggle(includeCaption);
|
||||||
@ -157,7 +157,7 @@ $(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// removed jQuery UI theme because of the accordion!
|
// removed jQuery UI theme because of the accordion!
|
||||||
$('link.theme').each(function(){ this.disabled = true; });
|
$('link.theme').each(function() { this.disabled = true; });
|
||||||
|
|
||||||
var themes = 'blue default green grey ice black-ice dark dropbox metro-dark',
|
var themes = 'blue default green grey ice black-ice dark dropbox metro-dark',
|
||||||
i, o = '', t = themes.split(' ');
|
i, o = '', t = themes.split(' ');
|
||||||
@ -167,13 +167,13 @@ $(function() {
|
|||||||
|
|
||||||
$('select:first')
|
$('select:first')
|
||||||
.append(o)
|
.append(o)
|
||||||
.change(function(){
|
.change(function() {
|
||||||
var theme = $(this).val().toLowerCase(),
|
var theme = $(this).val().toLowerCase(),
|
||||||
// ui-theme is added by the themeswitcher
|
// ui-theme is added by the themeswitcher
|
||||||
files = $('link.theme').each(function(){
|
files = $('link.theme').each(function() {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
})
|
})
|
||||||
files.filter('.' + theme).each(function(){
|
files.filter('.' + theme).each(function() {
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
});
|
});
|
||||||
$('table')
|
$('table')
|
||||||
|
@ -85,7 +85,7 @@
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('#switcher').jui_theme_switch({
|
$('#switcher').jui_theme_switch({
|
||||||
stylesheet_link_id : 'ui-theme',
|
stylesheet_link_id : 'ui-theme',
|
||||||
default_theme : 'cupertino',
|
default_theme : 'cupertino',
|
||||||
|
@ -725,7 +725,7 @@ html[xmlns] .clearfix {
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script id="js">$(function(){
|
<script id="js">$(function() {
|
||||||
/* Initial settings */
|
/* Initial settings */
|
||||||
var template = '<li class="clearfix">' +
|
var template = '<li class="clearfix">' +
|
||||||
'<section class="left">{col0}' +
|
'<section class="left">{col0}' +
|
||||||
@ -786,7 +786,7 @@ html[xmlns] .clearfix {
|
|||||||
});</script>
|
});</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function() {
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
},
|
},
|
||||||
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
// this remove function is called when using the refreshWidgets method or when destroying the tablesorter plugin
|
||||||
// this function only applies to tablesorter v2.4+
|
// this function only applies to tablesorter v2.4+
|
||||||
remove: function(table, c){
|
remove: function(table, c) {
|
||||||
c.$tbodies.children("tr.repeated-header").remove();
|
c.$tbodies.children("tr.repeated-header").remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ $.tablesorter.addWidget({
|
|||||||
},
|
},
|
||||||
// The init function (added v2.0.28) is called only after tablesorter has
|
// The init function (added v2.0.28) is called only after tablesorter has
|
||||||
// initialized, but before initial sort & before any of the widgets are applied.
|
// initialized, but before initial sort & before any of the widgets are applied.
|
||||||
init: function(table, thisWidget, config, widgetOptions){
|
init: function(table, thisWidget, config, widgetOptions) {
|
||||||
// widget initialization code - this is only *RUN ONCE*
|
// widget initialization code - this is only *RUN ONCE*
|
||||||
// but in this example, only the format function is called to from here
|
// but in this example, only the format function is called to from here
|
||||||
// to keep the widget backwards compatible with the original tablesorter
|
// to keep the widget backwards compatible with the original tablesorter
|
||||||
@ -187,7 +187,7 @@ $.tablesorter.addWidget({
|
|||||||
// function above otherwise initFlag is undefined
|
// function above otherwise initFlag is undefined
|
||||||
// * see the saveSort widget for a full example *
|
// * see the saveSort widget for a full example *
|
||||||
},
|
},
|
||||||
remove: function(table, config, widgetOptions, refreshing){
|
remove: function(table, config, widgetOptions, refreshing) {
|
||||||
// do what ever needs to be done to remove stuff added by your widget
|
// do what ever needs to be done to remove stuff added by your widget
|
||||||
// unbind events, restore hidden content, etc.
|
// unbind events, restore hidden content, etc.
|
||||||
// refreshing flag is true when the refreshWidgets method is triggered, meaning
|
// refreshing flag is true when the refreshWidgets method is triggered, meaning
|
||||||
|
338
docs/index.html
338
docs/index.html
File diff suppressed because it is too large
Load Diff
@ -34,8 +34,8 @@
|
|||||||
showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
|
showProcessing : false, // show an indeterminate timer icon in the header when the table is sorted or filtered.
|
||||||
|
|
||||||
headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> // class from cssIcon
|
headerTemplate : '{content}',// header layout template (HTML ok); {content} = innerHTML, {icon} = <i/> // class from cssIcon
|
||||||
onRenderTemplate : null, // function( index, template ){ return template; }, // template is a string
|
onRenderTemplate : null, // function( index, template ) { return template; }, // template is a string
|
||||||
onRenderHeader : null, // function( index ){}, // nothing to return
|
onRenderHeader : null, // function( index ) {}, // nothing to return
|
||||||
|
|
||||||
// *** functionality
|
// *** functionality
|
||||||
cancelSelection : true, // prevent text selection in the header
|
cancelSelection : true, // prevent text selection in the header
|
||||||
@ -64,7 +64,7 @@
|
|||||||
emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero, emptyMax, emptyMin
|
emptyTo : 'bottom', // sort empty cell to bottom, top, none, zero, emptyMax, emptyMin
|
||||||
stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
|
stringTo : 'max', // sort strings in numerical column as max, min, top, bottom, zero
|
||||||
duplicateSpan : true, // colspan cells in the tbody will have duplicated content in the cache for each spanned column
|
duplicateSpan : true, // colspan cells in the tbody will have duplicated content in the cache for each spanned column
|
||||||
textExtraction : 'basic', // text extraction method/function - function( node, table, cellIndex ){}
|
textExtraction : 'basic', // text extraction method/function - function( node, table, cellIndex ) {}
|
||||||
textAttribute : 'data-text',// data-attribute that contains alternate cell text (used in default textExtraction function)
|
textAttribute : 'data-text',// data-attribute that contains alternate cell text (used in default textExtraction function)
|
||||||
textSorter : null, // choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText]
|
textSorter : null, // choose overall or specific column sorter function( a, b, direction, table, columnIndex ) [alt: ts.sortText]
|
||||||
numberSorter : null, // choose overall numeric sorter function( a, b, direction, maxColumnValue )
|
numberSorter : null, // choose overall numeric sorter function( a, b, direction, maxColumnValue )
|
||||||
@ -78,7 +78,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// *** callbacks
|
// *** callbacks
|
||||||
initialized : null, // function( table ){},
|
initialized : null, // function( table ) {},
|
||||||
|
|
||||||
// *** extra css class names
|
// *** extra css class names
|
||||||
tableClass : '',
|
tableClass : '',
|
||||||
@ -764,7 +764,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
getParserById : function( name ) {
|
getParserById : function( name ) {
|
||||||
/*jshint eqeqeq:false */
|
/*jshint eqeqeq:false */ // eslint-disable-next-line eqeqeq
|
||||||
if ( name == 'false' ) { return false; }
|
if ( name == 'false' ) { return false; }
|
||||||
var indx,
|
var indx,
|
||||||
len = ts.parsers.length;
|
len = ts.parsers.length;
|
||||||
@ -1125,8 +1125,8 @@
|
|||||||
// direction = 2 means reset!
|
// direction = 2 means reset!
|
||||||
if ( list[ indx ][ 1 ] !== 2 ) {
|
if ( list[ indx ][ 1 ] !== 2 ) {
|
||||||
// multicolumn sorting updating - see #1005
|
// multicolumn sorting updating - see #1005
|
||||||
// .not(function(){}) needs jQuery 1.4
|
// .not(function() {}) needs jQuery 1.4
|
||||||
// filter(function(i, el){}) <- el is undefined in jQuery v1.2.6
|
// filter(function(i, el) {}) <- el is undefined in jQuery v1.2.6
|
||||||
$sorted = c.$headers.filter( function( i ) {
|
$sorted = c.$headers.filter( function( i ) {
|
||||||
// only include headers that are in the sortList (this includes colspans)
|
// only include headers that are in the sortList (this includes colspans)
|
||||||
var include = true,
|
var include = true,
|
||||||
@ -1535,7 +1535,7 @@
|
|||||||
initSort : function( c, cell, event ) {
|
initSort : function( c, cell, event ) {
|
||||||
if ( c.table.isUpdating ) {
|
if ( c.table.isUpdating ) {
|
||||||
// let any updates complete before initializing a sort
|
// let any updates complete before initializing a sort
|
||||||
return setTimeout( function(){
|
return setTimeout( function() {
|
||||||
ts.initSort( c, cell, event );
|
ts.initSort( c, cell, event );
|
||||||
}, 50 );
|
}, 50 );
|
||||||
}
|
}
|
||||||
@ -2697,7 +2697,7 @@
|
|||||||
is : function( str ) {
|
is : function( str ) {
|
||||||
return ts.regex.isoDate.test( str );
|
return ts.regex.isoDate.test( str );
|
||||||
},
|
},
|
||||||
format : function( str, table ) {
|
format : function( str ) {
|
||||||
var date = str ? new Date( str.replace( ts.regex.dash, '/' ) ) : str;
|
var date = str ? new Date( str.replace( ts.regex.dash, '/' ) ) : str;
|
||||||
return date instanceof Date && isFinite( date ) ? date.getTime() : str;
|
return date instanceof Date && isFinite( date ) ? date.getTime() : str;
|
||||||
},
|
},
|
||||||
@ -2740,7 +2740,7 @@
|
|||||||
// Jan 01, 2013 12:34:56 PM or 01 Jan 2013
|
// Jan 01, 2013 12:34:56 PM or 01 Jan 2013
|
||||||
return ts.regex.usLongDateTest1.test( str ) || ts.regex.usLongDateTest2.test( str );
|
return ts.regex.usLongDateTest1.test( str ) || ts.regex.usLongDateTest2.test( str );
|
||||||
},
|
},
|
||||||
format : function( str, table ) {
|
format : function( str ) {
|
||||||
var date = str ? new Date( str.replace( ts.regex.dateReplace, '$1 $2' ) ) : str;
|
var date = str ? new Date( str.replace( ts.regex.dateReplace, '$1 $2' ) ) : str;
|
||||||
return date instanceof Date && isFinite( date ) ? date.getTime() : str;
|
return date instanceof Date && isFinite( date ) ? date.getTime() : str;
|
||||||
},
|
},
|
||||||
@ -2801,7 +2801,7 @@
|
|||||||
is : function( str ) {
|
is : function( str ) {
|
||||||
return ts.regex.timeTest.test( str );
|
return ts.regex.timeTest.test( str );
|
||||||
},
|
},
|
||||||
format : function( str, table ) {
|
format : function( str ) {
|
||||||
// isolate time... ignore month, day and year
|
// isolate time... ignore month, day and year
|
||||||
var temp,
|
var temp,
|
||||||
timePart = ( str || '' ).match( ts.regex.timeMatch ),
|
timePart = ( str || '' ).match( ts.regex.timeMatch ),
|
||||||
@ -2868,7 +2868,7 @@
|
|||||||
var tbodyIndex, $tbody,
|
var tbodyIndex, $tbody,
|
||||||
$tbodies = c.$tbodies,
|
$tbodies = c.$tbodies,
|
||||||
toRemove = ( wo.zebra || [ 'even', 'odd' ] ).join( ' ' );
|
toRemove = ( wo.zebra || [ 'even', 'odd' ] ).join( ' ' );
|
||||||
for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ){
|
for ( tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
|
||||||
$tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
|
$tbody = ts.processTbody( table, $tbodies.eq( tbodyIndex ), true ); // remove tbody
|
||||||
$tbody.children().removeClass( toRemove );
|
$tbody.children().removeClass( toRemove );
|
||||||
ts.processTbody( table, $tbody, false ); // restore tbody
|
ts.processTbody( table, $tbody, false ); // restore tbody
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
|
/*! Parser: Extract out date - updated 10/26/2014 (v2.18.0) */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var regex = {
|
var regex = {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* See https://github.com/Mottie/tablesorter/issues/247
|
* See https://github.com/Mottie/tablesorter/issues/247
|
||||||
*/
|
*/
|
||||||
/*global jQuery: false */
|
/*global jQuery: false */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
|
var iso8601date = /^([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?$/;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*! Parser: Month - updated 11/22/2015 (v2.24.6) */
|
/*! Parser: Month - updated 11/22/2015 (v2.24.6) */
|
||||||
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ts = $.tablesorter;
|
var ts = $.tablesorter;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*! Parser: date ranges -updated 11/22/2015 (v2.24.6) */
|
/*! Parser: date ranges -updated 11/22/2015 (v2.24.6) */
|
||||||
/* Include the 'widget-filter-type-insideRange.js' to filter ranges */
|
/* Include the 'widget-filter-type-insideRange.js' to filter ranges */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ts = $.tablesorter,
|
var ts = $.tablesorter,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*! Parser: two digit year - updated 11/26/2016 (v2.28.0) */
|
/*! Parser: two digit year - updated 11/26/2016 (v2.28.0) */
|
||||||
/* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */
|
/* Demo: http://mottie.github.io/tablesorter/docs/example-parsers-dates.html */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Make the date be within +/- range of the 2 digit year
|
// Make the date be within +/- range of the 2 digit year
|
||||||
@ -20,7 +20,7 @@
|
|||||||
ts.dates.regxxxxyy = /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/;
|
ts.dates.regxxxxyy = /(\d{1,2})[\/\s](\d{1,2})[\/\s](\d{2})/;
|
||||||
ts.dates.regyyxxxx = /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/;
|
ts.dates.regyyxxxx = /(\d{2})[\/\s](\d{1,2})[\/\s](\d{1,2})/;
|
||||||
|
|
||||||
ts.formatDate = function(s, regex, format, table){
|
ts.formatDate = function(s, regex, format, table) {
|
||||||
if (s) {
|
if (s) {
|
||||||
var y, rng,
|
var y, rng,
|
||||||
n = s
|
n = s
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*! Parser: weekday - updated 11/22/2015 (v2.24.6) */
|
/*! Parser: weekday - updated 11/22/2015 (v2.24.6) */
|
||||||
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
/* Demo: http://jsfiddle.net/Mottie/abkNM/4169/ */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ts = $.tablesorter;
|
var ts = $.tablesorter;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* Extract dates using popular natural language date parsers */
|
/* Extract dates using popular natural language date parsers */
|
||||||
/*jshint jquery:true */
|
/*jshint jquery:true */
|
||||||
/*global Sugar*/
|
/*global Sugar*/
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/*! Sugar (https://sugarjs.com/docs/#/DateParsing) */
|
/*! Sugar (https://sugarjs.com/docs/#/DateParsing) */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*! Parser: duration & countdown - updated 2/7/2015 (v2.19.0) */
|
/*! Parser: duration & countdown - updated 2/7/2015 (v2.19.0) */
|
||||||
/*jshint jquery:true, unused:false */
|
/*jshint jquery:true, unused:false */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// If any number > 9999, then set table.config.durationLength = 5
|
// If any number > 9999, then set table.config.durationLength = 5
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Demo: http://jsfiddle.net/Mottie/abkNM/154/
|
* Demo: http://jsfiddle.net/Mottie/abkNM/154/
|
||||||
*/
|
*/
|
||||||
/*global jQuery: false */
|
/*global jQuery: false */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var ts = $.tablesorter;
|
var ts = $.tablesorter;
|
||||||
@ -26,7 +26,7 @@
|
|||||||
n = p + parseInt(t[0], 10) / parseInt(t[1] || 1, 10);
|
n = p + parseInt(t[0], 10) / parseInt(t[1] || 1, 10);
|
||||||
// look for fraction symbols
|
// look for fraction symbols
|
||||||
} else if (ts.symbolRegex.test(n)) {
|
} else if (ts.symbolRegex.test(n)) {
|
||||||
n = p + n.replace(ts.symbolRegex, function(m){
|
n = p + n.replace(ts.symbolRegex, function(m) {
|
||||||
return {
|
return {
|
||||||
'\u215b' : '.125', // 1/8
|
'\u215b' : '.125', // 1/8
|
||||||
'\u215c' : '.375', // 3/8
|
'\u215c' : '.375', // 3/8
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* prefixed into the parsed data, so sorting occurs in groups
|
* prefixed into the parsed data, so sorting occurs in groups
|
||||||
*/
|
*/
|
||||||
/*global jQuery: false */
|
/*global jQuery: false */
|
||||||
;(function($){
|
;(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
|
// basic list from http://en.wikipedia.org/wiki/List_of_file_formats
|
||||||
@ -51,7 +51,7 @@
|
|||||||
if (!m) {
|
if (!m) {
|
||||||
// make a string to 'quick' match the existing equivalents
|
// make a string to 'quick' match the existing equivalents
|
||||||
t = [];
|
t = [];
|
||||||
$.each(types, function(i, v){
|
$.each(types, function(i, v) {
|
||||||
t.push(v);
|
t.push(v);
|
||||||
});
|
});
|
||||||
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
|
m = $.tablesorter.fileTypes.matching = sep + t.join(sep) + sep;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user