stop method propagation at the table - fixes #263

This commit is contained in:
Mottie 2013-03-23 09:41:33 -05:00
parent 24d5aabaa6
commit c9d4d12aa5
3 changed files with 19 additions and 1 deletions

View File

@ -469,23 +469,29 @@
fixHeight(table, c); fixHeight(table, c);
}) })
.bind('disable.pager', function(){ .bind('disable.pager', function(){
e.stopPropagation();
showAllRows(table, c); showAllRows(table, c);
}) })
.bind('enable.pager', function(){ .bind('enable.pager', function(){
e.stopPropagation();
enablePager(table, c, true); enablePager(table, c, true);
}) })
.bind('destroy.pager', function(){ .bind('destroy.pager', function(){
e.stopPropagation();
destroyPager(table, c); destroyPager(table, c);
}) })
.bind('update.pager', function(){ .bind('update.pager', function(){
e.stopPropagation();
hideRows(table, c); hideRows(table, c);
}) })
.bind('pageSize.pager', function(e,v){ .bind('pageSize.pager', function(e,v){
e.stopPropagation();
c.size = parseInt(v, 10) || 10; c.size = parseInt(v, 10) || 10;
hideRows(table, c); hideRows(table, c);
updatePageDisplay(table, c); updatePageDisplay(table, c);
}) })
.bind('pageSet.pager', function(e,v){ .bind('pageSet.pager', function(e,v){
e.stopPropagation();
c.page = (parseInt(v, 10) || 1) - 1; c.page = (parseInt(v, 10) || 1) - 1;
moveToPage(table, c); moveToPage(table, c);
updatePageDisplay(table, c); updatePageDisplay(table, c);

View File

@ -724,12 +724,14 @@
$this $this
.unbind('sortReset update updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave '.split(' ').join('.tablesorter ')) .unbind('sortReset update updateRows updateCell addRows sorton appendCache applyWidgetId applyWidgets refreshWidgets destroy mouseup mouseleave '.split(' ').join('.tablesorter '))
.bind("sortReset.tablesorter", function(){ .bind("sortReset.tablesorter", function(){
e.stopPropagation();
c.sortList = []; c.sortList = [];
setHeadersCss(table); setHeadersCss(table);
multisort(table); multisort(table);
appendToTable(table); appendToTable(table);
}) })
.bind("update.tablesorter updateRows.tablesorter", function(e, resort, callback) { .bind("update.tablesorter updateRows.tablesorter", function(e, resort, callback) {
e.stopPropagation();
// remove rows/elements before update // remove rows/elements before update
$this.find(c.selectorRemove).remove(); $this.find(c.selectorRemove).remove();
// update sorting // update sorting
@ -741,6 +743,7 @@
checkResort($this, resort, callback); checkResort($this, resort, callback);
}) })
.bind("updateCell.tablesorter", function(e, cell, resort, callback) { .bind("updateCell.tablesorter", function(e, cell, resort, callback) {
e.stopPropagation();
$this.find(c.selectorRemove).remove(); $this.find(c.selectorRemove).remove();
// get position from the dom // get position from the dom
var l, row, icell, var l, row, icell,
@ -761,6 +764,7 @@
} }
}) })
.bind("addRows.tablesorter", function(e, $row, resort, callback) { .bind("addRows.tablesorter", function(e, $row, resort, callback) {
e.stopPropagation();
var i, rows = $row.filter('tr').length, var i, rows = $row.filter('tr').length,
dat = [], l = $row[0].cells.length, dat = [], l = $row[0].cells.length,
tbdy = $this.find('tbody').index( $row.closest('tbody') ); tbdy = $this.find('tbody').index( $row.closest('tbody') );
@ -785,6 +789,7 @@
checkResort($this, resort, callback); checkResort($this, resort, callback);
}) })
.bind("sorton.tablesorter", function(e, list, callback, init) { .bind("sorton.tablesorter", function(e, list, callback, init) {
e.stopPropagation();
$this.trigger("sortStart", this); $this.trigger("sortStart", this);
// update header count index // update header count index
updateHeaderSortCount(table, list); updateHeaderSortCount(table, list);
@ -798,22 +803,27 @@
} }
}) })
.bind("appendCache.tablesorter", function(e, callback, init) { .bind("appendCache.tablesorter", function(e, callback, init) {
e.stopPropagation();
appendToTable(table, init); appendToTable(table, init);
if (typeof callback === "function") { if (typeof callback === "function") {
callback(table); callback(table);
} }
}) })
.bind("applyWidgetId.tablesorter", function(e, id) { .bind("applyWidgetId.tablesorter", function(e, id) {
e.stopPropagation();
ts.getWidgetById(id).format(table, c, c.widgetOptions); ts.getWidgetById(id).format(table, c, c.widgetOptions);
}) })
.bind("applyWidgets.tablesorter", function(e, init) { .bind("applyWidgets.tablesorter", function(e, init) {
e.stopPropagation();
// apply widgets // apply widgets
ts.applyWidget(table, init); ts.applyWidget(table, init);
}) })
.bind("refreshWidgets.tablesorter", function(e, all, dontapply){ .bind("refreshWidgets.tablesorter", function(e, all, dontapply){
e.stopPropagation();
ts.refreshWidgets(table, all, dontapply); ts.refreshWidgets(table, all, dontapply);
}) })
.bind("destroy.tablesorter", function(e, c, cb){ .bind("destroy.tablesorter", function(e, c, cb){
e.stopPropagation();
ts.destroy(table, c, cb); ts.destroy(table, c, cb);
}); });

View File

@ -572,6 +572,7 @@ $.tablesorter.addWidget({
$t $t
.bind('addRows updateCell update updateRows updateComplete appendCache filterReset search '.split(' ').join('.tsfilter '), function(e, filter){ .bind('addRows updateCell update updateRows updateComplete appendCache filterReset search '.split(' ').join('.tsfilter '), function(e, filter){
if (!/(search|filterReset)/.test(e.type)){ if (!/(search|filterReset)/.test(e.type)){
e.stopPropagation();
buildDefault(true); buildDefault(true);
} }
if (e.type === 'filterReset') { if (e.type === 'filterReset') {
@ -1011,7 +1012,8 @@ $.tablesorter.addWidget({
if (c.debug){ if (c.debug){
$.tablesorter.benchmark('saveSort: Last sort loaded: "' + sortList + '"', time); $.tablesorter.benchmark('saveSort: Last sort loaded: "' + sortList + '"', time);
} }
$t.bind('saveSortReset', function(){ $t.bind('saveSortReset', function(e){
e.stopPropagation();
$.tablesorter.storage( table, 'tablesorter-savesort', '' ); $.tablesorter.storage( table, 'tablesorter-savesort', '' );
}); });
} }