mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Debug: update debug logging
pager, columnSelector & filter
This commit is contained in:
parent
a69a746fdf
commit
c17aa829e6
@ -216,6 +216,9 @@
|
||||
pagerArrows(p);
|
||||
fixHeight(table, p);
|
||||
if (p.initialized && completed !== false) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerComplete');
|
||||
}
|
||||
c.$table.trigger('pagerComplete', p);
|
||||
// save pager info to storage
|
||||
if (p.savePages && ts.storage) {
|
||||
@ -386,7 +389,7 @@
|
||||
|
||||
if ( exception ) {
|
||||
if (c.debug) {
|
||||
ts.log('Ajax Error', xhr, exception);
|
||||
ts.log('Pager: >> Ajax Error', xhr, exception);
|
||||
}
|
||||
ts.showError(table,
|
||||
xhr.status === 0 ? 'Not connected, verify Network' :
|
||||
@ -481,6 +484,9 @@
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
setTimeout(function(){
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerChange');
|
||||
}
|
||||
$t
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerChange', p);
|
||||
@ -493,6 +499,9 @@
|
||||
if (!p.initialized) {
|
||||
p.initialized = true;
|
||||
p.initializing = false;
|
||||
if (table.config.debug) {
|
||||
ts.log('Pager: Triggering pagerInitialized');
|
||||
}
|
||||
$(table)
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerInitialized', p);
|
||||
@ -530,7 +539,7 @@
|
||||
}
|
||||
};
|
||||
if (c.debug) {
|
||||
ts.log('ajax initialized', p.ajaxObject);
|
||||
ts.log('Pager: Ajax initialized', p.ajaxObject);
|
||||
}
|
||||
$.ajax(p.ajaxObject);
|
||||
}
|
||||
@ -574,7 +583,7 @@
|
||||
url = p.customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager ajax url: ' + url);
|
||||
ts.log('Pager: Ajax url = ' + url);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
@ -589,7 +598,7 @@
|
||||
e = p.size;
|
||||
if ( l < 1 ) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: no rows for pager to render');
|
||||
ts.log('Pager: >> No rows for pager to render');
|
||||
}
|
||||
// empty table, abort!
|
||||
return;
|
||||
@ -600,7 +609,12 @@
|
||||
}
|
||||
p.cacheIndex = [];
|
||||
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
||||
if (p.initialized) { $t.trigger('pagerChange', p); }
|
||||
if (p.initialized) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerChange');
|
||||
}
|
||||
$t.trigger('pagerChange', p);
|
||||
}
|
||||
|
||||
if ( !p.removeRows ) {
|
||||
hideRows(table, p);
|
||||
@ -627,6 +641,9 @@
|
||||
}
|
||||
updatePageDisplay(table, p);
|
||||
if (table.isUpdating) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering updateComplete');
|
||||
}
|
||||
$t.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
},
|
||||
@ -648,7 +665,7 @@
|
||||
renderTable(table, table.config.rowsCopy, p);
|
||||
$(table).trigger('applyWidgets');
|
||||
if (table.config.debug) {
|
||||
ts.log('pager disabled');
|
||||
ts.log('Pager: Disabled');
|
||||
}
|
||||
}
|
||||
// disable size selector
|
||||
@ -702,7 +719,7 @@
|
||||
(l.optAjaxUrl || '') === (p.ajaxUrl || '') &&
|
||||
l.sortList === (c.sortList || []).join(',') ) { return; }
|
||||
if (c.debug) {
|
||||
ts.log('Pager changing to page ' + p.page);
|
||||
ts.log('Pager: Changing to page ' + p.page);
|
||||
}
|
||||
p.last = {
|
||||
page : p.page,
|
||||
@ -721,10 +738,16 @@
|
||||
}
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
if (p.initialized && pageMoved !== false) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pageMoved');
|
||||
}
|
||||
$t
|
||||
.trigger('pageMoved', p)
|
||||
.trigger('applyWidgets');
|
||||
if (table.isUpdating) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering updateComplete');
|
||||
}
|
||||
$t.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
}
|
||||
@ -802,7 +825,7 @@
|
||||
setPageSize(table, p.size, p);
|
||||
hideRowsSetup(table, p);
|
||||
if (c.debug) {
|
||||
ts.log('pager enabled');
|
||||
ts.log('Pager: Enabled');
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -836,7 +859,7 @@
|
||||
// save a copy of the original settings
|
||||
p.settings = $.extend( true, {}, $.tablesorterPager.defaults, settings );
|
||||
if (c.debug) {
|
||||
ts.log('Pager initializing');
|
||||
ts.log('Pager: Initializing');
|
||||
}
|
||||
p.oldAjaxSuccess = p.oldAjaxSuccess || p.ajaxObject.success;
|
||||
c.appender = $this.appender;
|
||||
@ -929,6 +952,9 @@
|
||||
// clicked controls
|
||||
ctrls = [ p.cssFirst, p.cssPrev, p.cssNext, p.cssLast ];
|
||||
fxn = [ moveToFirstPage, moveToPrevPage, moveToNextPage, moveToLastPage ];
|
||||
if (c.debug && !pager.length) {
|
||||
ts.log('Pager: >> Container not found');
|
||||
}
|
||||
pager.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.unbind('click.pager')
|
||||
@ -955,6 +981,8 @@
|
||||
moveToPage(table, p, true);
|
||||
updatePageDisplay(table, p, false);
|
||||
});
|
||||
} else if (c.debug) {
|
||||
ts.log('Pager: >> Goto selector not found');
|
||||
}
|
||||
|
||||
// page size selector
|
||||
@ -970,6 +998,8 @@
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else if (c.debug) {
|
||||
ts.log('Pager: >> Size selector not found');
|
||||
}
|
||||
|
||||
// clear initialized flag
|
||||
@ -997,7 +1027,10 @@
|
||||
p.initializing = false;
|
||||
p.initialized = true;
|
||||
moveToPage(table, p);
|
||||
$(table).trigger('pagerInitialized', p);
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerInitialized');
|
||||
}
|
||||
c.$table.trigger('pagerInitialized', p);
|
||||
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
|
||||
updatePageDisplay(table, p, false);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
4
dist/js/jquery.tablesorter.widgets.js
vendored
4
dist/js/jquery.tablesorter.widgets.js
vendored
@ -1139,7 +1139,7 @@ ts.filter = {
|
||||
}).get();
|
||||
|
||||
if (c.debug) {
|
||||
ts.log('Starting filter widget search', filters);
|
||||
ts.log('Filter: Starting filter widget search', filters);
|
||||
time = new Date();
|
||||
}
|
||||
// filtered rows count
|
||||
@ -1217,7 +1217,7 @@ ts.filter = {
|
||||
// can't search when all rows are hidden - this happens when looking for exact matches
|
||||
if (searchFiltered && notFiltered === 0) { searchFiltered = false; }
|
||||
if (c.debug) {
|
||||
ts.log( "Searching through " + ( searchFiltered && notFiltered < len ? notFiltered : "all" ) + " rows" );
|
||||
ts.log( 'Filter: Searching through ' + ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
|
||||
}
|
||||
if (data.anyMatchFlag) {
|
||||
if (c.sortLocaleCompare) {
|
||||
|
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-columnSelector.min.js
vendored
2
dist/js/widgets/widget-columnSelector.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-filter.min.js
vendored
2
dist/js/widgets/widget-filter.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/widgets/widget-pager.min.js
vendored
2
dist/js/widgets/widget-pager.min.js
vendored
File diff suppressed because one or more lines are too long
@ -147,7 +147,7 @@
|
||||
prev : '.prev', // previous page arrow
|
||||
next : '.next', // next page arrow
|
||||
last : '.last', // go to last page arrow
|
||||
goto : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
prev : '.prev', // previous page arrow
|
||||
next : '.next', // next page arrow
|
||||
last : '.last', // go to last page arrow
|
||||
goto : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||
}
|
||||
|
@ -1145,7 +1145,7 @@ ts.filter = {
|
||||
}).get();
|
||||
|
||||
if (c.debug) {
|
||||
ts.log('Starting filter widget search', filters);
|
||||
ts.log('Filter: Starting filter widget search', filters);
|
||||
time = new Date();
|
||||
}
|
||||
// filtered rows count
|
||||
@ -1223,7 +1223,7 @@ ts.filter = {
|
||||
// can't search when all rows are hidden - this happens when looking for exact matches
|
||||
if (searchFiltered && notFiltered === 0) { searchFiltered = false; }
|
||||
if (c.debug) {
|
||||
ts.log( "Searching through " + ( searchFiltered && notFiltered < len ? notFiltered : "all" ) + " rows" );
|
||||
ts.log( 'Filter: Searching through ' + ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
|
||||
}
|
||||
if (data.anyMatchFlag) {
|
||||
if (c.sortLocaleCompare) {
|
||||
|
@ -21,7 +21,7 @@ tsColSel = ts.columnSelector = {
|
||||
$t = $(wo.columnSelector_layout);
|
||||
if (!$t.find('input').add( $t.filter('input') ).length) {
|
||||
if (c.debug) {
|
||||
ts.log('*** ERROR: Column Selector aborting, no input found in the layout! ***');
|
||||
ts.log('ColumnSelector: >> ERROR: Column Selector aborting, no input found in the layout! ***');
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -45,6 +45,8 @@ tsColSel = ts.columnSelector = {
|
||||
colSel.isInitializing = false;
|
||||
if (colSel.$container.length) {
|
||||
tsColSel.updateCols(c, wo);
|
||||
} else if (c.debug) {
|
||||
ts.log('ColumnSelector: >> container not found');
|
||||
}
|
||||
|
||||
c.$table
|
||||
|
@ -796,7 +796,7 @@ ts.filter = {
|
||||
}).get();
|
||||
|
||||
if (c.debug) {
|
||||
ts.log('Starting filter widget search', filters);
|
||||
ts.log('Filter: Starting filter widget search', filters);
|
||||
time = new Date();
|
||||
}
|
||||
// filtered rows count
|
||||
@ -874,7 +874,7 @@ ts.filter = {
|
||||
// can't search when all rows are hidden - this happens when looking for exact matches
|
||||
if (searchFiltered && notFiltered === 0) { searchFiltered = false; }
|
||||
if (c.debug) {
|
||||
ts.log( "Searching through " + ( searchFiltered && notFiltered < len ? notFiltered : "all" ) + " rows" );
|
||||
ts.log( 'Filter: Searching through ' + ( searchFiltered && notFiltered < len ? notFiltered : 'all' ) + ' rows' );
|
||||
}
|
||||
if (data.anyMatchFlag) {
|
||||
if (c.sortLocaleCompare) {
|
||||
|
@ -151,7 +151,7 @@ tsp = ts.pager = {
|
||||
|
||||
p.isInitializing = true;
|
||||
if (c.debug) {
|
||||
ts.log('Pager initializing');
|
||||
ts.log('Pager: Initializing');
|
||||
}
|
||||
|
||||
p.size = $.data(table, 'pagerLastSize') || wo.pager_size;
|
||||
@ -196,7 +196,7 @@ tsp = ts.pager = {
|
||||
} else {
|
||||
p.ajax = false;
|
||||
// Regular pager; all rows stored in memory
|
||||
c.$table.trigger("appendCache", [{}, true]);
|
||||
c.$table.trigger('appendCache', [{}, true]);
|
||||
}
|
||||
|
||||
},
|
||||
@ -214,6 +214,9 @@ tsp = ts.pager = {
|
||||
p.initialized = true;
|
||||
p.initializing = false;
|
||||
p.isInitializing = false;
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerInitialized');
|
||||
}
|
||||
c.$table.trigger('pagerInitialized', c);
|
||||
// filter widget not initialized; it will update the output display & fire off the pagerComplete event
|
||||
if ( !( c.widgetOptions.filter_initialized && ts.hasWidget(table, 'filter') ) ) {
|
||||
@ -310,6 +313,9 @@ tsp = ts.pager = {
|
||||
// clicked controls
|
||||
ctrls = [ s.first, s.prev, s.next, s.last ];
|
||||
fxn = [ 'moveToFirstPage', 'moveToPrevPage', 'moveToNextPage', 'moveToLastPage' ];
|
||||
if (c.debug && !p.$container.length) {
|
||||
ts.log('Pager: >> Container not found');
|
||||
}
|
||||
p.$container.find(ctrls.join(','))
|
||||
.attr("tabindex", 0)
|
||||
.off('click.pager')
|
||||
@ -336,6 +342,8 @@ tsp = ts.pager = {
|
||||
tsp.moveToPage(table, p, true);
|
||||
tsp.updatePageDisplay(table, c, false);
|
||||
});
|
||||
} else if (c.debug) {
|
||||
ts.log('Pager: >> Goto selector not found');
|
||||
}
|
||||
|
||||
if ( p.$size.length ) {
|
||||
@ -351,6 +359,8 @@ tsp = ts.pager = {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
} else if (c.debug) {
|
||||
ts.log('Pager: >> Size selector not found');
|
||||
}
|
||||
|
||||
},
|
||||
@ -455,6 +465,9 @@ tsp = ts.pager = {
|
||||
tsp.pagerArrows(c);
|
||||
tsp.fixHeight(table, c);
|
||||
if (p.initialized && completed !== false) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerComplete');
|
||||
}
|
||||
c.$table.trigger('pagerComplete', c);
|
||||
// save pager info to storage
|
||||
if (wo.pager_savePages && ts.storage) {
|
||||
@ -629,7 +642,7 @@ tsp = ts.pager = {
|
||||
|
||||
if ( exception ) {
|
||||
if (c.debug) {
|
||||
ts.log('Ajax Error', xhr, exception);
|
||||
ts.log('Pager: >> Ajax Error', xhr, exception);
|
||||
}
|
||||
ts.showError(table, exception.message + ' (' + xhr.status + ')');
|
||||
c.$tbodies.eq(0).children('tr').detach();
|
||||
@ -719,6 +732,9 @@ tsp = ts.pager = {
|
||||
// apply widgets after table has rendered & after a delay to prevent
|
||||
// multiple applyWidget blocking code from blocking this trigger
|
||||
setTimeout(function(){
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerChange');
|
||||
}
|
||||
$t
|
||||
.trigger('applyWidgets')
|
||||
.trigger('pagerChange', p);
|
||||
@ -760,7 +776,7 @@ tsp = ts.pager = {
|
||||
}
|
||||
};
|
||||
if (c.debug) {
|
||||
ts.log('ajax initialized', p.ajaxObject);
|
||||
ts.log('Pager: Ajax initialized', p.ajaxObject);
|
||||
}
|
||||
$.ajax(p.ajaxObject);
|
||||
}
|
||||
@ -805,7 +821,7 @@ tsp = ts.pager = {
|
||||
url = wo.pager_customAjaxUrl(table, url);
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager ajax url: ' + url);
|
||||
ts.log('Pager: Ajax url = ' + url);
|
||||
}
|
||||
return url;
|
||||
},
|
||||
@ -821,7 +837,7 @@ tsp = ts.pager = {
|
||||
e = p.size;
|
||||
if ( l < 1 ) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: no rows for pager to render');
|
||||
ts.log('Pager: >> No rows for pager to render');
|
||||
}
|
||||
// empty table, abort!
|
||||
return;
|
||||
@ -832,7 +848,12 @@ tsp = ts.pager = {
|
||||
}
|
||||
p.cacheIndex = [];
|
||||
p.isDisabled = false; // needed because sorting will change the page and re-enable the pager
|
||||
if (p.initialized) { c.$table.trigger('pagerChange', c); }
|
||||
if (p.initialized) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pagerChange');
|
||||
}
|
||||
c.$table.trigger('pagerChange', c);
|
||||
}
|
||||
if ( !wo.pager_removeRows ) {
|
||||
tsp.hideRows(table, c);
|
||||
} else {
|
||||
@ -861,6 +882,9 @@ tsp = ts.pager = {
|
||||
wo.pager_startPage = p.page;
|
||||
wo.pager_size = p.size;
|
||||
if (table.isUpdating) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering updateComplete');
|
||||
}
|
||||
c.$table.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
|
||||
@ -885,7 +909,7 @@ tsp = ts.pager = {
|
||||
tsp.renderTable(table, c.rowsCopy);
|
||||
c.$table.trigger('applyWidgets');
|
||||
if (c.debug) {
|
||||
ts.log('pager disabled');
|
||||
ts.log('Pager: Disabled');
|
||||
}
|
||||
}
|
||||
// disable size selector
|
||||
@ -948,7 +972,7 @@ tsp = ts.pager = {
|
||||
return;
|
||||
}
|
||||
if (c.debug) {
|
||||
ts.log('Pager changing to page ' + p.page);
|
||||
ts.log('Pager: Changing to page ' + p.page);
|
||||
}
|
||||
p.last = {
|
||||
page : p.page,
|
||||
@ -967,10 +991,16 @@ tsp = ts.pager = {
|
||||
}
|
||||
$.data(table, 'pagerLastPage', p.page);
|
||||
if (p.initialized && pageMoved !== false) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering pageMoved');
|
||||
}
|
||||
c.$table
|
||||
.trigger('pageMoved', c)
|
||||
.trigger('applyWidgets');
|
||||
if (!p.ajax && table.isUpdating) {
|
||||
if (c.debug) {
|
||||
ts.log('Pager: Triggering updateComplete');
|
||||
}
|
||||
c.$table.trigger('updateComplete', [ table, true ]);
|
||||
}
|
||||
}
|
||||
@ -1047,7 +1077,7 @@ tsp = ts.pager = {
|
||||
tsp.setPageSize(table, p.size, c);
|
||||
tsp.hideRowsSetup(table, c);
|
||||
if (c.debug) {
|
||||
ts.log('pager enabled');
|
||||
ts.log('Pager: Enabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user