Global: call internal functions directly; stop using trigger

This commit is contained in:
Rob Garrison 2015-10-22 16:41:34 -05:00
parent 035a394459
commit 5d4529c37d
30 changed files with 115 additions and 111 deletions

View File

@ -484,7 +484,8 @@
p.last.currentFilters = p.currentFilters; p.last.currentFilters = p.currentFilters;
p.last.sortList = (c.sortList || []).join(','); p.last.sortList = (c.sortList || []).join(',');
updatePageDisplay(table, p, false); updatePageDisplay(table, p, false);
$table.trigger('updateCache', [ function(){ // tablesorter core updateCache (not pager)
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
@ -492,13 +493,12 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
$table $table.trigger( 'pagerChange', p );
.trigger('applyWidgets') ts.applyWidget( table );
.trigger('pagerChange', p);
updatePageDisplay(table, p, true); updatePageDisplay(table, p, true);
}, 0); }, 0);
} }
} ]); });
} }
if (!p.initialized) { if (!p.initialized) {
@ -507,9 +507,8 @@
if (table.config.debug) { if (table.config.debug) {
console.log('Pager: Triggering pagerInitialized'); console.log('Pager: Triggering pagerInitialized');
} }
$(table) $(table).trigger( 'pagerInitialized', p );
.trigger('applyWidgets') ts.applyWidget( table );
.trigger('pagerInitialized', p);
updatePageDisplay(table, p); updatePageDisplay(table, p);
} }
}, },
@ -619,7 +618,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
$t.trigger('pagerChange', p); $t.trigger( 'pagerChange', p );
} }
if ( !p.removeRows && !p.showAll ) { if ( !p.removeRows && !p.showAll ) {
hideRows(table, p); hideRows(table, p);
@ -670,7 +669,7 @@
.find('tr.pagerSavedHeightSpacer').remove(); .find('tr.pagerSavedHeightSpacer').remove();
renderTable(table, table.config.rowsCopy, p); renderTable(table, table.config.rowsCopy, p);
p.isDisabled = true; p.isDisabled = true;
$(table).trigger('applyWidgets'); ts.applyWidget( table );
if (table.config.debug) { if (table.config.debug) {
console.log('Pager: Disabled'); console.log('Pager: Disabled');
} }
@ -691,7 +690,8 @@
updateCache = function(table) { updateCache = function(table) {
var c = table.config, var c = table.config,
p = c.pager; p = c.pager;
c.$table.trigger('updateCache', [ function(){ // tablesorter core updateCache (not pager)
ts.updateCache( c, function(){
var i, var i,
rows = [], rows = [],
n = table.config.cache[0].normalized; n = table.config.cache[0].normalized;
@ -701,7 +701,7 @@
} }
c.rowsCopy = rows; c.rowsCopy = rows;
moveToPage(table, p, true); moveToPage(table, p, true);
} ]); });
}, },
moveToPage = function(table, p, pageMoved) { moveToPage = function(table, p, pageMoved) {
@ -753,9 +753,8 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pageMoved'); console.log('Pager: Triggering pageMoved');
} }
$t $t.trigger('pageMoved', p);
.trigger('pageMoved', p) ts.applyWidget( table );
.trigger('applyWidgets');
if (table.isUpdating) { if (table.isUpdating) {
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering updateComplete'); console.log('Pager: Triggering updateComplete');
@ -842,7 +841,8 @@
} }
changeHeight(table, p); changeHeight(table, p);
if ( triggered ) { if ( triggered ) {
c.$table.trigger('updateRows'); // tablesorter core update table
ts.update( c );
setPageSize(table, p.size, p); setPageSize(table, p.size, p);
hideRowsSetup(table, p); hideRowsSetup(table, p);
if (c.debug) { if (c.debug) {
@ -917,7 +917,7 @@
} }
updatePageDisplay(table, p, false); updatePageDisplay(table, p, false);
moveToPage(table, p, false); moveToPage(table, p, false);
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
} }
}) })
.bind('disablePager' + namespace, function(e){ .bind('disablePager' + namespace, function(e){
@ -1046,7 +1046,7 @@
} else { } else {
p.ajax = false; p.ajax = false;
// Regular pager; all rows stored in memory // Regular pager; all rows stored in memory
$(this).trigger('appendCache', true); ts.appendCache( c, true ); // true = don't apply widgets
hideRowsSetup(table, p); hideRowsSetup(table, p);
} }
@ -1058,7 +1058,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerInitialized'); console.log('Pager: Triggering pagerInitialized');
} }
c.$table.trigger('pagerInitialized', p); c.$table.trigger( 'pagerInitialized', p );
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) { if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
updatePageDisplay(table, p, false); updatePageDisplay(table, p, false);
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -307,7 +307,7 @@
ts.applyWidget( table, true ); ts.applyWidget( table, true );
// if user has supplied a sort list to constructor // if user has supplied a sort list to constructor
if ( c.sortList.length > 0 ) { if ( c.sortList.length > 0 ) {
$table.trigger( 'sorton', [ c.sortList, {}, !c.initWidgets, true ] ); ts.sortOn( c, c.sortList, {}, !c.initWidgets );
} else { } else {
ts.setHeadersCss( c ); ts.setHeadersCss( c );
if ( c.initWidgets ) { if ( c.initWidgets ) {
@ -1614,14 +1614,14 @@
// this will catch spamming of the updateCell method // this will catch spamming of the updateCell method
if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) { if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) {
if ( sortList.length ) { if ( sortList.length ) {
c.$table.trigger( 'sorton', [ sortList, function() { ts.sortOn( c, sortList, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
}, true ] ); }, true );
} else { } else {
c.$table.trigger( 'sortReset', [ function() { ts.sortReset( c, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
ts.applyWidget( c.table, false ); ts.applyWidget( c.table, false );
} ] ); } );
} }
} else { } else {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
@ -3753,9 +3753,9 @@
if ( $.isEmptyObject( c.cache ) ) { if ( $.isEmptyObject( c.cache ) ) {
// update cache if delayInit set & pager has initialized ( after user initiates a search ) // update cache if delayInit set & pager has initialized ( after user initiates a search )
if ( c.delayInit && c.pager && c.pager.initialized ) { if ( c.delayInit && c.pager && c.pager.initialized ) {
c.$table.trigger( 'updateCache', [ function() { ts.updateCache( c, function() {
tsf.checkFilters( table, false, skipFirst ); tsf.checkFilters( table, false, skipFirst );
} ] ); });
} }
return; return;
} }
@ -4329,7 +4329,7 @@
c.$table.trigger( 'filterEnd', c ); c.$table.trigger( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'applyWidgets' ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
}, 0 ); }, 0 );
}, },
getOptionSource: function( table, column, onlyAvail ) { getOptionSource: function( table, column, onlyAvail ) {
@ -5401,7 +5401,7 @@
c.sortList = sortList; c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$table.trigger('sorton', [ sortList ]); ts.sortOn( c, sortList );
} }
} }
}, },

File diff suppressed because one or more lines are too long

View File

@ -305,7 +305,7 @@
ts.applyWidget( table, true ); ts.applyWidget( table, true );
// if user has supplied a sort list to constructor // if user has supplied a sort list to constructor
if ( c.sortList.length > 0 ) { if ( c.sortList.length > 0 ) {
$table.trigger( 'sorton', [ c.sortList, {}, !c.initWidgets, true ] ); ts.sortOn( c, c.sortList, {}, !c.initWidgets );
} else { } else {
ts.setHeadersCss( c ); ts.setHeadersCss( c );
if ( c.initWidgets ) { if ( c.initWidgets ) {
@ -1612,14 +1612,14 @@
// this will catch spamming of the updateCell method // this will catch spamming of the updateCell method
if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) { if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) {
if ( sortList.length ) { if ( sortList.length ) {
c.$table.trigger( 'sorton', [ sortList, function() { ts.sortOn( c, sortList, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
}, true ] ); }, true );
} else { } else {
c.$table.trigger( 'sortReset', [ function() { ts.sortReset( c, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
ts.applyWidget( c.table, false ); ts.applyWidget( c.table, false );
} ] ); } );
} }
} else { } else {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );

File diff suppressed because one or more lines are too long

View File

@ -1179,9 +1179,9 @@
if ( $.isEmptyObject( c.cache ) ) { if ( $.isEmptyObject( c.cache ) ) {
// update cache if delayInit set & pager has initialized ( after user initiates a search ) // update cache if delayInit set & pager has initialized ( after user initiates a search )
if ( c.delayInit && c.pager && c.pager.initialized ) { if ( c.delayInit && c.pager && c.pager.initialized ) {
c.$table.trigger( 'updateCache', [ function() { ts.updateCache( c, function() {
tsf.checkFilters( table, false, skipFirst ); tsf.checkFilters( table, false, skipFirst );
} ] ); });
} }
return; return;
} }
@ -1755,7 +1755,7 @@
c.$table.trigger( 'filterEnd', c ); c.$table.trigger( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'applyWidgets' ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
}, 0 ); }, 0 );
}, },
getOptionSource: function( table, column, onlyAvail ) { getOptionSource: function( table, column, onlyAvail ) {
@ -2827,7 +2827,7 @@
c.sortList = sortList; c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$table.trigger('sorton', [ sortList ]); ts.sortOn( c, sortList );
} }
} }
}, },

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! Parser: input & select - updated 8/17/2015 (v2.23.0) */ /*! Parser: input & select - updated 8/17/2015 (v2.23.0) */
!function(a){"use strict";var b=function(a,b,c){};a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,type:"numeric"}),a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d,e){var f=a(d),g=f.closest("tr"),h=c.config.widgetOptions,i=c.config.checkboxClass||"checked",j=h.group_checkbox?h.group_checkbox:["checked","unchecked"],k=f.find('input[type="checkbox"]'),l=k.length?k[0].checked:"";return g.toggleClass(i+"-"+e,l),l?g.addClass(i):g.length&&!(g[0].className||"").match(i+"-")&&g.removeClass(i),k.length?j[l?0:1]:b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,type:"text"}),a(function(){a("table").on("tablesorter-initialized updateComplete",function(){var c=".parser-forms",d=function(b){b&&a(":focus").blur()};a(this).children("tbody").off(c).on("mouseleave"+c,function(a){d("TBODY"===a.target.nodeName)}).on("focus"+c,"select, input, textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+c,"input, textarea",function(){this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(c+" "),"select, input, textarea",function(c){if(27===c.which)return void(this.value=a(this).data("ts-original-value"));if("change"===c.type||"keyup"===c.type&&13===c.which&&("INPUT"===c.target.nodeName||"TEXTAREA"===c.target.nodeName&&c.altKey)){var d,e=a(c.target),f=e.closest("td"),g=f.closest("table"),h=f[0].cellIndex,i=g[0].config||!1,j=i&&i.$headerIndexed&&i.$headerIndexed[h]||[],k=e.val();if(j.length&&(j.hasClass("parser-false")||j.hasClass("sorter-false")&&j.hasClass("filter-false")))return;(k!==e.data("ts-original-value")||"checkbox"===c.target.type)&&(e.data("ts-original-value",k),g.trigger("updateCell",[f,d,function(){b(c,g,e)}]))}})})})}(jQuery); !function(a){"use strict";var b=function(a,b,c){};a.tablesorter.addParser({id:"inputs",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"inputs-numeric",is:function(){return!1},format:function(b,c,d){var e=a(d).find("input"),f=e.length?e.val():b,g=a.tablesorter.formatFloat((f||"").replace(/[^\w,. \-()]/g,""),c);return b&&"number"==typeof g?g:b?a.trim(b&&c.config.ignoreCase?b.toLocaleLowerCase():b):b},parsed:!0,type:"numeric"}),a.tablesorter.addParser({id:"checkbox",is:function(){return!1},format:function(b,c,d,e){var f=a(d),g=f.closest("tr"),h=c.config.widgetOptions,i=c.config.checkboxClass||"checked",j=h.group_checkbox?h.group_checkbox:["checked","unchecked"],k=f.find('input[type="checkbox"]'),l=k.length?k[0].checked:"";return g.toggleClass(i+"-"+e,l),l?g.addClass(i):g.length&&!(g[0].className||"").match(i+"-")&&g.removeClass(i),k.length?j[l?0:1]:b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.val():b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"select-text",is:function(){return!1},format:function(b,c,d){var e=a(d).find("select");return e.length?e.find("option:selected").text()||"":b},parsed:!0,type:"text"}),a.tablesorter.addParser({id:"textarea",is:function(){return!1},format:function(b,c,d){var e=a(d).find("textarea");return e.length?e.val():b},parsed:!0,type:"text"}),a(function(){a("table").on("tablesorter-initialized updateComplete",function(){var c=".parser-forms",d=function(b){b&&a(":focus").blur()};a(this).children("tbody").off(c).on("mouseleave"+c,function(a){d("TBODY"===a.target.nodeName)}).on("focus"+c,"select, input, textarea",function(){a(this).data("ts-original-value",this.value)}).on("blur"+c,"input, textarea",function(){this.value=a(this).data("ts-original-value")}).on("change keyup ".split(" ").join(c+" "),"select, input, textarea",function(c){if(27===c.which)return void(this.value=a(this).data("ts-original-value"));if("change"===c.type||"keyup"===c.type&&13===c.which&&("INPUT"===c.target.nodeName||"TEXTAREA"===c.target.nodeName&&c.altKey)){var d,e=a(c.target),f=e.closest("td"),g=f.closest("table"),h=f[0].cellIndex,i=g[0].config||!1,j=i&&i.$headerIndexed&&i.$headerIndexed[h]||[],k=e.val();if(j.length&&(j.hasClass("parser-false")||j.hasClass("sorter-false")&&j.hasClass("filter-false")))return;(i&&k!==e.data("ts-original-value")||"checkbox"===c.target.type)&&(e.data("ts-original-value",k),a.tablesorter.updateCell(i,f,d,function(){b(c,g,e)}))}})})})}(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*! Widget: math - updated 7/28/2015 (v2.22.4) */ /*! Widget: math - updated 7/28/2015 (v2.22.4) */
!function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"},invalid:function(a,b,d){return console.log(b,c.error[d]),a&&a.widgetOptions.math_none||"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute);return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d},getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f},getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.math_dataAttrib,m=k.filter_filteredRow||"filtered",n=parseInt(b.attr("data-column"),10),o=a.$table.children("tbody").children(),p=b.closest("tr");if("above"===d)for(g=o.index(p),e=g;e>=0;)f=o.eq(e).children().filter("[data-column="+n+"]"),i=f.filter("["+l+"^=above]").length,(!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else if("below"===d)for(g=o.length,e=o.index(p)+1;g>e&&(f=o.eq(e).children().filter("[data-column="+n+"]"),!f.filter("["+l+"^=below]").length);e++)!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&f.length&&j.push(c.processText(a,f));else for(h=o.not("["+l+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+n+"]"),h.eq(e).hasClass(m)||!f.not("["+l+"^=above],["+l+"^=below],["+l+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j},getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.math_dataAttrib,o=m.filter_filteredRow||"filtered",p=b.$table.children("tbody").children().not("["+n+"=ignore]");for(h=p.length,g=0;h>g;g++)if(f=p.eq(g),!f.hasClass(o))for(i=f.children().not("["+n+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+n+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},setColumnIndexes:function(c){c.$table.after('<div id="_tablesorter_table_placeholder"></div>');var d=c.$table.detach();b.computeColumnIndex(d.children("tbody").children()),a("#_tablesorter_table_placeholder").after(d).remove()},recalculate:function(a,d,e){if(a&&(!d.math_isUpdating||e)){var f,g,h;a.debug&&(f=new Date),e&&c.setColumnIndexes(a),d.math_dataAttrib="data-"+(d.math_data||"math"),g=d.math_dataAttrib,h=a.$tbodies.find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.children("."+a.cssInfoBlock+", tfoot").find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.find("["+g+"^=all]"),c.mathType(a,h,["all"]),d.math_isUpdating=!0,a.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"),a.$table.trigger("update"),a.debug&&console.log("Math widget update completed"+b.benchmark(f))}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=o.math_dataAttrib,q=b.equations;"all"===f[0]&&(k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"),a.each(f,function(a,b){if(l=e.filter("["+p+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),i.parent().hasClass(o.filter_filteredRow||"filtered")||(g=(i.attr(p)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),q[g]&&(j.length?(h=q[g](j,d),d.debug&&console.log(i.attr(p),j,"=",h)):h=c.invalid(d,g,"mean"===g?0:"undef"),c.output(i,o,h,j)));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}};/** !function(a){"use strict";var b=a.tablesorter,c={error:{0:"Infinity result: Divide by zero",1:"Need more than one element to make this calculation",undef:"No elements found"},invalid:function(a,b,d){return console.log(b,c.error[d]),a&&a.widgetOptions.math_none||"none"},events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),processText:function(a,c){var d=c.attr(a.textAttribute);return"undefined"==typeof d&&(d=c[0].textContent||c.text()),d=b.formatFloat(d.replace(/[^\w,. \-()]/g,""),a.table)||0,isNaN(d)?0:d},getRow:function(b,d){var e=b.widgetOptions,f=[],g=d.closest("tr"),h=g.children().not("["+e.math_dataAttrib+"=ignore]");return g.hasClass(e.filter_filteredRow||"filtered")||(e.math_ignore.length&&(h=h.not("[data-column="+e.math_ignore.join("],[data-column=")+"]")),f=h.not(d).map(function(){return c.processText(b,a(this))}).get()),f},getColumn:function(a,b,d){var e,f,g,h,i,j=[],k=a.widgetOptions,l=k.math_dataAttrib,m=k.filter_filteredRow||"filtered",n=parseInt(b.attr("data-column"),10),o=a.$table.children("tbody").children(),p=b.closest("tr");if("above"===d)for(g=o.index(p),e=g;e>=0;)f=o.eq(e).children().filter("[data-column="+n+"]"),i=f.filter("["+l+"^=above]").length,(!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&e!==g||i&&e!==g)&&(i?e=0:f.length&&j.push(c.processText(a,f))),e--;else if("below"===d)for(g=o.length,e=o.index(p)+1;g>e&&(f=o.eq(e).children().filter("[data-column="+n+"]"),!f.filter("["+l+"^=below]").length);e++)!o.eq(e).hasClass(m)&&o.eq(e).not("["+l+"=ignore]").length&&f.length&&j.push(c.processText(a,f));else for(h=o.not("["+l+"=ignore]"),g=h.length,e=0;g>e;e++)f=h.eq(e).children().filter("[data-column="+n+"]"),h.eq(e).hasClass(m)||!f.not("["+l+"^=above],["+l+"^=below],["+l+"^=col]").length||f.is(b)||j.push(c.processText(a,f));return j},getAll:function(b){var d,e,f,g,h,i,j,k,l=[],m=b.widgetOptions,n=m.math_dataAttrib,o=m.filter_filteredRow||"filtered",p=b.$table.children("tbody").children().not("["+n+"=ignore]");for(h=p.length,g=0;h>g;g++)if(f=p.eq(g),!f.hasClass(o))for(i=f.children().not("["+n+"=ignore]"),k=i.length,j=0;k>j;j++)d=i.eq(j),e=parseInt(d.attr("data-column"),10),!d.filter("["+n+"]").length&&a.inArray(e,m.math_ignore)<0&&l.push(c.processText(b,d));return l},setColumnIndexes:function(c){c.$table.after('<div id="_tablesorter_table_placeholder"></div>');var d=c.$table.detach();b.computeColumnIndex(d.children("tbody").children()),a("#_tablesorter_table_placeholder").after(d).remove()},recalculate:function(a,d,e){if(a&&(!d.math_isUpdating||e)){var f,g,h;a.debug&&(f=new Date),e&&c.setColumnIndexes(a),d.math_dataAttrib="data-"+(d.math_data||"math"),g=d.math_dataAttrib,h=a.$tbodies.find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.children("."+a.cssInfoBlock+", tfoot").find("["+g+"]"),c.mathType(a,h,d.math_priority),h=a.$table.find("["+g+"^=all]"),c.mathType(a,h,["all"]),d.math_isUpdating=!0,a.debug&&console[console.group?"group":"log"]("Math widget triggering an update after recalculation"),b.update(a),a.debug&&console.log("Math widget update completed"+b.benchmark(f))}},mathType:function(d,e,f){if(e.length){var g,h,i,j,k,l,m,n,o=d.widgetOptions,p=o.math_dataAttrib,q=b.equations;"all"===f[0]&&(k=c.getAll(d)),d.debug&&console[console.group?"group":"log"]("Tablesorter Math widget recalculation"),a.each(f,function(a,b){if(l=e.filter("["+p+"^="+b+"]"),n=l.length){for(d.debug&&console[console.group?"group":"log"](b),m=0;n>m;m++)i=l.eq(m),i.parent().hasClass(o.filter_filteredRow||"filtered")||(g=(i.attr(p)||"").replace(b+"-",""),j="row"===b?c.getRow(d,i):"all"===b?k:c.getColumn(d,i,b),q[g]&&(j.length?(h=q[g](j,d),d.debug&&console.log(i.attr(p),j,"=",h)):h=c.invalid(d,g,"mean"===g?0:"undef"),c.output(i,o,h,j)));d.debug&&console.groupEnd&&console.groupEnd()}}),d.debug&&console.groupEnd&&console.groupEnd()}},output:function(a,c,d,e){var f=a.attr("data-"+c.math_data+"-mask")||c.math_mask,g=b.formatMask(f,d,c.math_wrapPrefix,c.math_wrapSuffix);"function"==typeof c.math_complete&&(g=c.math_complete(a,c,g,d,e)),g!==!1&&a.html(g)}};/**
* @preserve IntegraXor Web SCADA - JavaScript Number Formatter * @preserve IntegraXor Web SCADA - JavaScript Number Formatter
* http:// www.integraxor.com/ * http:// www.integraxor.com/
* author: KPL, KHL * author: KPL, KHL

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! Widget: saveSort */ /*! Widget: saveSort */
!function(a){"use strict";var b=a.tablesorter||{};b.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(a,b,c,d){b.format(a,c,d,!0)},format:function(c,d,e,f){var g,h,i=d.$table,j=e.saveSort!==!1,k={sortList:d.sortList};d.debug&&(h=new Date),i.hasClass("hasSaveSort")?j&&c.hasInitialized&&b.storage&&(b.storage(c,"tablesorter-savesort",k),d.debug&&console.log("saveSort widget: Saving last sort: "+d.sortList+b.benchmark(h))):(i.addClass("hasSaveSort"),k="",b.storage&&(g=b.storage(c,"tablesorter-savesort"),k=g&&g.hasOwnProperty("sortList")&&a.isArray(g.sortList)?g.sortList:"",d.debug&&console.log('saveSort: Last sort loaded: "'+k+'"'+b.benchmark(h)),i.bind("saveSortReset",function(a){a.stopPropagation(),b.storage(c,"tablesorter-savesort","")})),f&&k&&k.length>0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&i.trigger("sorton",[k]))},remove:function(a,c){c.$table.removeClass("hasSaveSort"),b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery); !function(a){"use strict";var b=a.tablesorter||{};b.addWidget({id:"saveSort",priority:20,options:{saveSort:!0},init:function(a,b,c,d){b.format(a,c,d,!0)},format:function(c,d,e,f){var g,h,i=d.$table,j=e.saveSort!==!1,k={sortList:d.sortList};d.debug&&(h=new Date),i.hasClass("hasSaveSort")?j&&c.hasInitialized&&b.storage&&(b.storage(c,"tablesorter-savesort",k),d.debug&&console.log("saveSort widget: Saving last sort: "+d.sortList+b.benchmark(h))):(i.addClass("hasSaveSort"),k="",b.storage&&(g=b.storage(c,"tablesorter-savesort"),k=g&&g.hasOwnProperty("sortList")&&a.isArray(g.sortList)?g.sortList:"",d.debug&&console.log('saveSort: Last sort loaded: "'+k+'"'+b.benchmark(h)),i.bind("saveSortReset",function(a){a.stopPropagation(),b.storage(c,"tablesorter-savesort","")})),f&&k&&k.length>0?d.sortList=k:c.hasInitialized&&k&&k.length>0&&b.sortOn(d,k))},remove:function(a,c){c.$table.removeClass("hasSaveSort"),b.storage&&b.storage(a,"tablesorter-savesort","")}})}(jQuery);

View File

@ -2,4 +2,4 @@
* Requires tablesorter v2.22.2+ and jQuery 1.4+ * Requires tablesorter v2.22.2+ and jQuery 1.4+
* by Rob Garrison * by Rob Garrison
*/ */
!function(a){"use strict";var b=a.tablesorter;b.sortTbodies={init:function(c,d){var e,f,g,h,i,j=c.namespace+"sortTbody",k=c.$table.children("tbody"),l=k.length;for(d.sortTbody_original_serverSideSorting=c.serverSideSorting,d.sortTbody_original_cssInfoBlock=c.cssInfoBlock,c.cssInfoBlock=d.sortTbody_noSort,b.sortTbodies.setTbodies(c,d),e=0;l>e;e++)k.eq(e).attr("data-ts-original-order",e);for(c.$table.unbind("sortBegin updateComplete ".split(" ").join(j+" ")).bind("sortBegin"+j,function(){b.sortTbodies.sorter(c)}).bind("updateComplete"+j,function(){b.sortTbodies.setTbodies(c,d),c.$table.trigger("updateCache",[null,c.$tbodies])}),(a.isEmptyObject(c.parsers)||c.$tbodies.length!==k.length)&&(b.sortTbodies.setTbodies(c,d),c.$table.trigger("updateCache",[null,c.$tbodies])),i=k.children("tr"),l=i.length,e=0;e<c.columns;e++){if(h=0,"numeric"===c.parsers[e].type)for(f=0;l>f;f++)g=b.getParsedText(c,i.eq(f).children()[e],e),h=Math.max(Math.abs(g)||0,h);c.$headerIndexed[e].attr("data-ts-col-max-value",h)}},setTbodies:function(a,b){a.$tbodies=a.$table.children("tbody").not("."+b.sortTbody_noSort)},sorter:function(c){var d=c.$table,e=c.widgetOptions;if(e.sortTbody_busy!==!0){e.sortTbody_busy=!0;var f=d.children("tbody").not("."+e.sortTbody_noSort),g=e.sortTbody_primaryRow||"tr:eq(0)",h=c.sortList||[],i=h.length;i&&(c.serverSideSorting=!e.sortTbody_sortRows,f.sort(function(d,e){var f,j,k,l,m,n,o,p,q,r,s,t,u=c.table,v=c.parsers,w=c.textSorter||"",x=a(d),y=a(e),z=x.find(g).children("td, th"),A=y.find(g).children("td, th");for(f=0;i>f;f++){if(o=h[f][0],p=h[f][1],k=0===p,j=b.getElementText(c,z.eq(o),o),q=v[o].format(j,u,z[o],o),j=b.getElementText(c,A.eq(o),o),r=v[o].format(j,u,A[o],o),c.sortStable&&q===r&&1===i)return x.attr("data-ts-original-order")-y.attr("data-ts-original-order");if(l=/n/i.test(v&&v[o]?v[o].type||"":""),l&&c.strings[o]?(m=c.$headerIndexed[o].attr("data-ts-col-max-value")||1.79e308,l="boolean"==typeof b.string[c.strings[o]]?(k?1:-1)*(b.string[c.strings[o]]?-1:1):c.strings[o]?b.string[c.strings[o]]||0:0,n=c.numberSorter?c.numberSorter(q,r,k,m,u):b["sortNumeric"+(k?"Asc":"Desc")](q,r,l,m,o,u)):(s=k?q:r,t=k?r:q,n="function"==typeof w?w(s,t,k,o,u):"object"==typeof w&&w.hasOwnProperty(o)?w[o](s,t,k,o,u):b["sortNatural"+(k?"Asc":"Desc")](q,r,o,u,c)),n)return n}return x.attr("data-ts-original-order")-y.attr("data-ts-original-order")}),b.sortTbodies.restoreTbodies(c,e,f),e.sortTbody_busy=!1)}},restoreTbodies:function(a,b,c){var d,e,f,g,h,i,j,k=a.$table,l=!0,m=0;if(k.hide(),c.appendTo(k),e=k.children("tbody"),g=e.length,d=e.filter("."+b.sortTbody_noSort).appendTo(k),h=d.length)for(;l&&h>m;){for(l=!1,i=0;h>i;i++)j=parseInt(d.eq(i).attr("data-ts-original-order"),10),j=j>=g?g:0>j?0:j,j!==d.eq(i).index()&&(l=!0,f=d.eq(i).detach(),j>=g?f.appendTo(k):0===j?f.prependTo(k):f.insertBefore(k.children("tbody:eq("+j+")")));m++}k.show()}},b.addWidget({id:"sortTbody",priority:40,options:{sortTbody_primaryRow:null,sortTbody_sortRows:!1,sortTbody_noSort:"tablesorter-no-sort-tbody"},init:function(a,c,d,e){b.sortTbodies.init(d,e)},remove:function(a,b,c,d){b.$table.unbind("sortBegin updateComplete ".split(" ").join(b.namespace+"sortTbody ")),b.serverSideSorting=c.sortTbody_original_serverSideSorting,b.cssInfoBlock=c.sortTbody_original_cssInfoBlock}})}(jQuery); !function(a){"use strict";var b=a.tablesorter;b.sortTbodies={init:function(c,d){var e,f,g,h,i,j=c.namespace+"sortTbody",k=c.$table.children("tbody"),l=k.length;for(d.sortTbody_original_serverSideSorting=c.serverSideSorting,d.sortTbody_original_cssInfoBlock=c.cssInfoBlock,c.cssInfoBlock=d.sortTbody_noSort,b.sortTbodies.setTbodies(c,d),e=0;l>e;e++)k.eq(e).attr("data-ts-original-order",e);for(c.$table.unbind("sortBegin updateComplete ".split(" ").join(j+" ")).bind("sortBegin"+j,function(){b.sortTbodies.sorter(c)}).bind("updateComplete"+j,function(){b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)}),(a.isEmptyObject(c.parsers)||c.$tbodies.length!==k.length)&&(b.sortTbodies.setTbodies(c,d),b.updateCache(c,null,c.$tbodies)),i=k.children("tr"),l=i.length,e=0;e<c.columns;e++){if(h=0,"numeric"===c.parsers[e].type)for(f=0;l>f;f++)g=b.getParsedText(c,i.eq(f).children()[e],e),h=Math.max(Math.abs(g)||0,h);c.$headerIndexed[e].attr("data-ts-col-max-value",h)}},setTbodies:function(a,b){a.$tbodies=a.$table.children("tbody").not("."+b.sortTbody_noSort)},sorter:function(c){var d=c.$table,e=c.widgetOptions;if(e.sortTbody_busy!==!0){e.sortTbody_busy=!0;var f=d.children("tbody").not("."+e.sortTbody_noSort),g=e.sortTbody_primaryRow||"tr:eq(0)",h=c.sortList||[],i=h.length;i&&(c.serverSideSorting=!e.sortTbody_sortRows,f.sort(function(d,e){var f,j,k,l,m,n,o,p,q,r,s,t,u=c.table,v=c.parsers,w=c.textSorter||"",x=a(d),y=a(e),z=x.find(g).children("td, th"),A=y.find(g).children("td, th");for(f=0;i>f;f++){if(o=h[f][0],p=h[f][1],k=0===p,j=b.getElementText(c,z.eq(o),o),q=v[o].format(j,u,z[o],o),j=b.getElementText(c,A.eq(o),o),r=v[o].format(j,u,A[o],o),c.sortStable&&q===r&&1===i)return x.attr("data-ts-original-order")-y.attr("data-ts-original-order");if(l=/n/i.test(v&&v[o]?v[o].type||"":""),l&&c.strings[o]?(m=c.$headerIndexed[o].attr("data-ts-col-max-value")||1.79e308,l="boolean"==typeof b.string[c.strings[o]]?(k?1:-1)*(b.string[c.strings[o]]?-1:1):c.strings[o]?b.string[c.strings[o]]||0:0,n=c.numberSorter?c.numberSorter(q,r,k,m,u):b["sortNumeric"+(k?"Asc":"Desc")](q,r,l,m,o,u)):(s=k?q:r,t=k?r:q,n="function"==typeof w?w(s,t,k,o,u):"object"==typeof w&&w.hasOwnProperty(o)?w[o](s,t,k,o,u):b["sortNatural"+(k?"Asc":"Desc")](q,r,o,c)),n)return n}return x.attr("data-ts-original-order")-y.attr("data-ts-original-order")}),b.sortTbodies.restoreTbodies(c,e,f),e.sortTbody_busy=!1)}},restoreTbodies:function(a,b,c){var d,e,f,g,h,i,j,k=a.$table,l=!0,m=0;if(k.hide(),c.appendTo(k),e=k.children("tbody"),g=e.length,d=e.filter("."+b.sortTbody_noSort).appendTo(k),h=d.length)for(;l&&h>m;){for(l=!1,i=0;h>i;i++)j=parseInt(d.eq(i).attr("data-ts-original-order"),10),j=j>=g?g:0>j?0:j,j!==d.eq(i).index()&&(l=!0,f=d.eq(i).detach(),j>=g?f.appendTo(k):0===j?f.prependTo(k):f.insertBefore(k.children("tbody:eq("+j+")")));m++}k.show()}},b.addWidget({id:"sortTbody",priority:40,options:{sortTbody_primaryRow:null,sortTbody_sortRows:!1,sortTbody_noSort:"tablesorter-no-sort-tbody"},init:function(a,c,d,e){b.sortTbodies.init(d,e)},remove:function(a,b,c,d){b.$table.unbind("sortBegin updateComplete ".split(" ").join(b.namespace+"sortTbody ")),b.serverSideSorting=c.sortTbody_original_serverSideSorting,b.cssInfoBlock=c.sortTbody_original_cssInfoBlock}})}(jQuery);

View File

@ -1,2 +1,2 @@
/*! widget: staticRow - updated 2/9/2015 (v2.19.1) */ /*! widget: staticRow - updated 2/9/2015 (v2.19.1) */
!function(a){"use strict";var b=a.tablesorter,c=function(b){var c,d,e,f,g,h=b.config;h&&(d=h.widgetOptions,h.$tbodies.each(function(){c=a(this).children(),g=c.length,c.filter(d.staticRow_class).each(function(){c=a(this),f=c.data(d.staticRow_index),"undefined"!=typeof f?(e=parseFloat(f),f=/%/.test(f)?Math.round(e/100*g):e):f=c.index(),c.data(d.staticRow_data,f)})}))};b.addWidget({id:"staticRow",options:{staticRow_class:".static",staticRow_data:"static-index",staticRow_index:"row-index",staticRow_event:"staticRowsRefresh"},init:function(a,b,d,e){c(a),d.$table.unbind(("updateComplete.tsstaticrows "+e.staticRow_event).replace(/\s+/g," ")).bind("updateComplete.tsstaticrows "+e.staticRow_event,function(){c(a),d.$table.trigger("applyWidgets")})},format:function(b,c,d){var e,f,g,h,i,j,k,l;c.$tbodies.each(function(){for(i=a.tablesorter.processTbody(b,a(this),!0),j=!0,g=0,k=i.children(d.staticRow_class),h=i.children("tr").length-1,l=k.length;j&&l>g;)j=!1,k.each(function(){e=a(this).data(d.staticRow_data),e=e>=h?h:0>e?0:e,e!==a(this).index()&&(j=!0,f=a(this).detach(),e>=h?f.appendTo(i):0===e?f.prependTo(i):f.insertBefore(i.find("tr:eq("+e+")")))}),g++;a.tablesorter.processTbody(b,i,!1)}),c.$table.trigger("staticRowsComplete",b)},remove:function(a,b,c){b.$table.unbind(("updateComplete.tsstaticrows "+c.staticRow_event).replace(/\s+/g," "))}})}(jQuery); !function(a){"use strict";var b=a.tablesorter,c=function(b){var c,d,e,f,g,h=b.config;h&&(d=h.widgetOptions,h.$tbodies.each(function(){c=a(this).children(),g=c.length,c.filter(d.staticRow_class).each(function(){c=a(this),f=c.data(d.staticRow_index),"undefined"!=typeof f?(e=parseFloat(f),f=/%/.test(f)?Math.round(e/100*g):e):f=c.index(),c.data(d.staticRow_data,f)})}))};b.addWidget({id:"staticRow",options:{staticRow_class:".static",staticRow_data:"static-index",staticRow_index:"row-index",staticRow_event:"staticRowsRefresh"},init:function(a,d,e,f){c(a),e.$table.unbind(("updateComplete.tsstaticrows "+f.staticRow_event).replace(/\s+/g," ")).bind("updateComplete.tsstaticrows "+f.staticRow_event,function(){c(a),b.applyWidget(a)})},format:function(b,c,d){var e,f,g,h,i,j,k,l;c.$tbodies.each(function(){for(i=a.tablesorter.processTbody(b,a(this),!0),j=!0,g=0,k=i.children(d.staticRow_class),h=i.children("tr").length-1,l=k.length;j&&l>g;)j=!1,k.each(function(){e=a(this).data(d.staticRow_data),e=e>=h?h:0>e?0:e,e!==a(this).index()&&(j=!0,f=a(this).detach(),e>=h?f.appendTo(i):0===e?f.prependTo(i):f.insertBefore(i.find("tr:eq("+e+")")))}),g++;a.tablesorter.processTbody(b,i,!1)}),c.$table.trigger("staticRowsComplete",b)},remove:function(a,b,c){b.$table.unbind(("updateComplete.tsstaticrows "+c.staticRow_event).replace(/\s+/g," "))}})}(jQuery);

View File

@ -226,7 +226,7 @@
} }
// update stickyHeader when menu closes // update stickyHeader when menu closes
$('#main-nav-check').on('change', function(){ $('#main-nav-check').bind('change', function(){
setTimeout(function(){ setTimeout(function(){
$(window).scroll(); $(window).scroll();
}, 350); // transition animation 300ms }, 350); // transition animation 300ms
@ -257,7 +257,7 @@
}); });
}); });
$('.toggleparsedvalue').on('click', function(){ $('.toggleparsedvalue').bind('click', function(){
$('.val').toggleClass('hidden'); $('.val').toggleClass('hidden');
return false; return false;
}); });

View File

@ -99,7 +99,7 @@
} }
*/ */
$table.trigger('updateAll', [ false, function() { ts.updateAll( c, false, function() {
if ( hasFilters ) { if ( hasFilters ) {
setTimeout( function() { setTimeout( function() {
// just update the filter values // just update the filter values
@ -111,7 +111,7 @@
} }
}, 10 ); }, 10 );
} }
} ]); });
} }
}, },
getOrder : function( table ) { getOrder : function( table ) {

View File

@ -313,7 +313,7 @@
ts.applyWidget( table, true ); ts.applyWidget( table, true );
// if user has supplied a sort list to constructor // if user has supplied a sort list to constructor
if ( c.sortList.length > 0 ) { if ( c.sortList.length > 0 ) {
$table.trigger( 'sorton', [ c.sortList, {}, !c.initWidgets, true ] ); ts.sortOn( c, c.sortList, {}, !c.initWidgets );
} else { } else {
ts.setHeadersCss( c ); ts.setHeadersCss( c );
if ( c.initWidgets ) { if ( c.initWidgets ) {
@ -1620,14 +1620,14 @@
// this will catch spamming of the updateCell method // this will catch spamming of the updateCell method
if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) { if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) {
if ( sortList.length ) { if ( sortList.length ) {
c.$table.trigger( 'sorton', [ sortList, function() { ts.sortOn( c, sortList, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
}, true ] ); }, true );
} else { } else {
c.$table.trigger( 'sortReset', [ function() { ts.sortReset( c, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
ts.applyWidget( c.table, false ); ts.applyWidget( c.table, false );
} ] ); } );
} }
} else { } else {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
@ -3759,9 +3759,9 @@
if ( $.isEmptyObject( c.cache ) ) { if ( $.isEmptyObject( c.cache ) ) {
// update cache if delayInit set & pager has initialized ( after user initiates a search ) // update cache if delayInit set & pager has initialized ( after user initiates a search )
if ( c.delayInit && c.pager && c.pager.initialized ) { if ( c.delayInit && c.pager && c.pager.initialized ) {
c.$table.trigger( 'updateCache', [ function() { ts.updateCache( c, function() {
tsf.checkFilters( table, false, skipFirst ); tsf.checkFilters( table, false, skipFirst );
} ] ); });
} }
return; return;
} }
@ -4335,7 +4335,7 @@
c.$table.trigger( 'filterEnd', c ); c.$table.trigger( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'applyWidgets' ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
}, 0 ); }, 0 );
}, },
getOptionSource: function( table, column, onlyAvail ) { getOptionSource: function( table, column, onlyAvail ) {
@ -5407,7 +5407,7 @@
c.sortList = sortList; c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$table.trigger('sorton', [ sortList ]); ts.sortOn( c, sortList );
} }
} }
}, },

View File

@ -295,7 +295,7 @@
ts.applyWidget( table, true ); ts.applyWidget( table, true );
// if user has supplied a sort list to constructor // if user has supplied a sort list to constructor
if ( c.sortList.length > 0 ) { if ( c.sortList.length > 0 ) {
$table.trigger( 'sorton', [ c.sortList, {}, !c.initWidgets, true ] ); ts.sortOn( c, c.sortList, {}, !c.initWidgets );
} else { } else {
ts.setHeadersCss( c ); ts.setHeadersCss( c );
if ( c.initWidgets ) { if ( c.initWidgets ) {
@ -1602,14 +1602,14 @@
// this will catch spamming of the updateCell method // this will catch spamming of the updateCell method
if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) { if ( resrt !== false && !c.serverSideSorting && !c.table.isProcessing ) {
if ( sortList.length ) { if ( sortList.length ) {
c.$table.trigger( 'sorton', [ sortList, function() { ts.sortOn( c, sortList, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
}, true ] ); }, true );
} else { } else {
c.$table.trigger( 'sortReset', [ function() { ts.sortReset( c, function() {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );
ts.applyWidget( c.table, false ); ts.applyWidget( c.table, false );
} ] ); } );
} }
} else { } else {
ts.resortComplete( c, callback ); ts.resortComplete( c, callback );

View File

@ -1185,9 +1185,9 @@
if ( $.isEmptyObject( c.cache ) ) { if ( $.isEmptyObject( c.cache ) ) {
// update cache if delayInit set & pager has initialized ( after user initiates a search ) // update cache if delayInit set & pager has initialized ( after user initiates a search )
if ( c.delayInit && c.pager && c.pager.initialized ) { if ( c.delayInit && c.pager && c.pager.initialized ) {
c.$table.trigger( 'updateCache', [ function() { ts.updateCache( c, function() {
tsf.checkFilters( table, false, skipFirst ); tsf.checkFilters( table, false, skipFirst );
} ] ); });
} }
return; return;
} }
@ -1761,7 +1761,7 @@
c.$table.trigger( 'filterEnd', c ); c.$table.trigger( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'applyWidgets' ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
}, 0 ); }, 0 );
}, },
getOptionSource: function( table, column, onlyAvail ) { getOptionSource: function( table, column, onlyAvail ) {
@ -2833,7 +2833,7 @@
c.sortList = sortList; c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$table.trigger('sorton', [ sortList ]); ts.sortOn( c, sortList );
} }
} }
}, },

View File

@ -175,12 +175,12 @@
return; return;
} }
// ignore change event if nothing changed // ignore change event if nothing changed
if ( val !== $target.data( 'ts-original-value' ) || event.target.type === 'checkbox' ) { if ( c && val !== $target.data( 'ts-original-value' ) || event.target.type === 'checkbox' ) {
$target.data( 'ts-original-value', val ); $target.data( 'ts-original-value', val );
// pass undefined resort value so it falls back to config.resort setting // pass undefined resort value so it falls back to config.resort setting
$table.trigger( 'updateCell', [ $cell, undef, function() { $.tablesorter.updateCell( c, $cell, undef, function() {
updateServer( event, $table, $target ); updateServer( event, $table, $target );
} ]); });
} }
} }
}); });

View File

@ -193,7 +193,9 @@
} }
if ( e.which === 27 ) { if ( e.which === 27 ) {
// user cancelled // user cancelled
$this.html( $this.data( 'original' ) ).trigger( 'blur' + namespace ); $this
.html( $this.data( 'original' ) )
.trigger( 'blur' + namespace );
c.$table.data( 'contentFocused', false ); c.$table.data( 'contentFocused', false );
c.table.isUpdating = false; c.table.isUpdating = false;
return false; return false;
@ -220,17 +222,17 @@
.data( 'before', valid ) .data( 'before', valid )
.data( 'original', valid ) .data( 'original', valid )
.trigger( 'change' ); .trigger( 'change' );
c.$table.trigger( 'updateCell', [ $this.closest( 'td' ), false, function() { $.tablesorter.updateCell( c, $this.closest( 'td' ), false, function() {
if ( wo.editable_autoResort ) { if ( wo.editable_autoResort ) {
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'sorton', [ c.sortList, function() { $.tablesorter.sortOn( c, c.sortList, function() {
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ), true ); tse.editComplete( c, wo, c.$table.data( 'contentFocused' ), true );
}, true ] ); }, true );
}, 10 ); }, 10 );
} else { } else {
tse.editComplete( c, wo, c.$table.data( 'contentFocused' ) ); tse.editComplete( c, wo, c.$table.data( 'contentFocused' ) );
} }
} ] ); });
return false; return false;
} }
} else if ( !valid && e.type !== 'keydown' ) { } else if ( !valid && e.type !== 'keydown' ) {

View File

@ -811,9 +811,9 @@
if ( $.isEmptyObject( c.cache ) ) { if ( $.isEmptyObject( c.cache ) ) {
// update cache if delayInit set & pager has initialized ( after user initiates a search ) // update cache if delayInit set & pager has initialized ( after user initiates a search )
if ( c.delayInit && c.pager && c.pager.initialized ) { if ( c.delayInit && c.pager && c.pager.initialized ) {
c.$table.trigger( 'updateCache', [ function() { ts.updateCache( c, function() {
tsf.checkFilters( table, false, skipFirst ); tsf.checkFilters( table, false, skipFirst );
} ] ); });
} }
return; return;
} }
@ -1387,7 +1387,7 @@
c.$table.trigger( 'filterEnd', c ); c.$table.trigger( 'filterEnd', c );
} }
setTimeout( function() { setTimeout( function() {
c.$table.trigger( 'applyWidgets' ); // make sure zebra widget is applied ts.applyWidget( c.table ); // make sure zebra widget is applied
}, 0 ); }, 0 );
}, },
getOptionSource: function( table, column, onlyAvail ) { getOptionSource: function( table, column, onlyAvail ) {

View File

@ -190,7 +190,8 @@
console[ console.group ? 'group' : 'log' ]( 'Math widget triggering an update after recalculation' ); console[ console.group ? 'group' : 'log' ]( 'Math widget triggering an update after recalculation' );
} }
c.$table.trigger( 'update' ); // update internal cache
ts.update( c );
if ( c.debug ) { if ( c.debug ) {
console.log( 'Math widget update completed' + ts.benchmark( time ) ); console.log( 'Math widget update completed' + ts.benchmark( time ) );

View File

@ -203,7 +203,7 @@
} else { } else {
p.ajax = false; p.ajax = false;
// Regular pager; all rows stored in memory // Regular pager; all rows stored in memory
c.$table.trigger('appendCache', [ {}, true ]); ts.appendCache( c, true ); // true = don't apply widgets
} }
}, },
@ -224,7 +224,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerInitialized'); console.log('Pager: Triggering pagerInitialized');
} }
c.$table.trigger('pagerInitialized', c); c.$table.trigger( 'pagerInitialized', c );
// filter widget not initialized; it will update the output display & fire off the pagerComplete event // filter widget not initialized; it will update the output display & fire off the pagerComplete event
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) { if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
// if ajax, then don't fire off pagerComplete // if ajax, then don't fire off pagerComplete
@ -258,7 +258,7 @@
} }
tsp.updatePageDisplay(table, c, false); tsp.updatePageDisplay(table, c, false);
// tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered // tsp.moveToPage(table, p, false); <-- called when applyWidgets is triggered
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
} }
}) })
.on('disablePager' + namespace, function(e){ .on('disablePager' + namespace, function(e){
@ -293,7 +293,7 @@
// update without triggering pagerComplete // update without triggering pagerComplete
tsp.updatePageDisplay(table, c, false); tsp.updatePageDisplay(table, c, false);
// make sure widgets are applied - fixes #450 // make sure widgets are applied - fixes #450
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
tsp.updatePageDisplay(table, c); tsp.updatePageDisplay(table, c);
}) })
.on('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, v){ .on('pageSize refreshComplete '.split(' ').join(namespace + ' '), function(e, v){
@ -754,7 +754,8 @@
p.initializing = false; p.initializing = false;
// update display without triggering pager complete... before updating cache // update display without triggering pager complete... before updating cache
tsp.updatePageDisplay(table, c, false); tsp.updatePageDisplay(table, c, false);
$table.trigger('updateCache', [ function(){ // tablesorter core updateCache (not pager)
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
@ -762,16 +763,15 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
$table $table.trigger( 'pagerChange', p );
.trigger('applyWidgets') ts.applyWidget( table );
.trigger('pagerChange', p);
tsp.updatePageDisplay(table, c); tsp.updatePageDisplay(table, c);
}, 0); }, 0);
} }
} ]); });
} }
if (!p.initialized) { if (!p.initialized) {
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
} }
}, },
@ -880,7 +880,7 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pagerChange'); console.log('Pager: Triggering pagerChange');
} }
c.$table.trigger('pagerChange', c); c.$table.trigger( 'pagerChange', c );
} }
if ( !wo.pager_removeRows && !p.showAll ) { if ( !wo.pager_removeRows && !p.showAll ) {
tsp.hideRows(table, c); tsp.hideRows(table, c);
@ -937,7 +937,7 @@
.find('tr.pagerSavedHeightSpacer').remove(); .find('tr.pagerSavedHeightSpacer').remove();
tsp.renderTable(table, c.rowsCopy); tsp.renderTable(table, c.rowsCopy);
p.isDisabled = true; p.isDisabled = true;
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
if (c.debug) { if (c.debug) {
console.log('Pager: Disabled'); console.log('Pager: Disabled');
} }
@ -959,7 +959,8 @@
updateCache: function(table) { updateCache: function(table) {
var c = table.config, var c = table.config,
p = c.pager; p = c.pager;
c.$table.trigger('updateCache', [ function(){ // tablesorter core updateCache (not pager)
ts.updateCache( c, function(){
if ( !$.isEmptyObject(table.config.cache) ) { if ( !$.isEmptyObject(table.config.cache) ) {
var i, var i,
rows = [], rows = [],
@ -973,7 +974,7 @@
// clear out last search to force an update // clear out last search to force an update
p.last.currentFilters = [ ' ' ]; p.last.currentFilters = [ ' ' ];
} }
} ]); });
}, },
moveToPage: function(table, p, pageMoved) { moveToPage: function(table, p, pageMoved) {
@ -1030,9 +1031,8 @@
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering pageMoved'); console.log('Pager: Triggering pageMoved');
} }
c.$table c.$table.trigger('pageMoved', c);
.trigger('pageMoved', c) ts.applyWidget( table );
.trigger('applyWidgets');
if (!p.ajax && table.isUpdating) { if (!p.ajax && table.isUpdating) {
if (c.debug) { if (c.debug) {
console.log('Pager: Triggering updateComplete'); console.log('Pager: Triggering updateComplete');
@ -1119,7 +1119,8 @@
} }
tsp.changeHeight(table, c); tsp.changeHeight(table, c);
if ( triggered ) { if ( triggered ) {
c.$table.trigger('updateRows'); // tablesorter core update table
ts.update( c );
tsp.setPageSize(table, p.size, c); tsp.setPageSize(table, p.size, c);
tsp.hideRowsSetup(table, c); tsp.hideRowsSetup(table, c);
if (c.debug) { if (c.debug) {

View File

@ -54,7 +54,7 @@
c.sortList = sortList; c.sortList = sortList;
} else if (table.hasInitialized && sortList && sortList.length > 0) { } else if (table.hasInitialized && sortList && sortList.length > 0) {
// update sort change // update sort change
$table.trigger('sorton', [ sortList ]); ts.sortOn( c, sortList );
} }
} }
}, },

View File

@ -37,13 +37,13 @@
.bind( 'updateComplete' + namespace, function() { .bind( 'updateComplete' + namespace, function() {
// find parsers for each column // find parsers for each column
ts.sortTbodies.setTbodies( c, wo ); ts.sortTbodies.setTbodies( c, wo );
c.$table.trigger( 'updateCache', [ null, c.$tbodies ] ); ts.updateCache( c, null, c.$tbodies );
}); });
// detect parsers - in case the table contains only info-only tbodies // detect parsers - in case the table contains only info-only tbodies
if ( $.isEmptyObject( c.parsers ) || c.$tbodies.length !== $tbodies.length ) { if ( $.isEmptyObject( c.parsers ) || c.$tbodies.length !== $tbodies.length ) {
ts.sortTbodies.setTbodies( c, wo ); ts.sortTbodies.setTbodies( c, wo );
c.$table.trigger( 'updateCache', [ null, c.$tbodies ] ); ts.updateCache( c, null, c.$tbodies );
} }
// find colMax; this only matter for numeric columns // find colMax; this only matter for numeric columns
@ -138,7 +138,7 @@
sort = cts[ col ]( x, y, dir, col, table ); sort = cts[ col ]( x, y, dir, col, table );
} else { } else {
// fall back to natural sort // fall back to natural sort
sort = ts[ 'sortNatural' + ( dir ? 'Asc' : 'Desc' ) ]( colA, colB, col, table, c ); sort = ts[ 'sortNatural' + ( dir ? 'Asc' : 'Desc' ) ]( colA, colB, col, c );
} }
} }
if ( sort ) { return sort; } if ( sort ) { return sort; }

View File

@ -62,7 +62,7 @@
.unbind( ('updateComplete.tsstaticrows ' + wo.staticRow_event).replace(/\s+/g, ' ') ) .unbind( ('updateComplete.tsstaticrows ' + wo.staticRow_event).replace(/\s+/g, ' ') )
.bind('updateComplete.tsstaticrows ' + wo.staticRow_event, function(){ .bind('updateComplete.tsstaticrows ' + wo.staticRow_event, function(){
addIndexes(table); addIndexes(table);
c.$table.trigger('applyWidgets'); ts.applyWidget( table );
}); });
}, },