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);
})
.bind('disable.pager', function(){
e.stopPropagation();
showAllRows(table, c);
})
.bind('enable.pager', function(){
e.stopPropagation();
enablePager(table, c, true);
})
.bind('destroy.pager', function(){
e.stopPropagation();
destroyPager(table, c);
})
.bind('update.pager', function(){
e.stopPropagation();
hideRows(table, c);
})
.bind('pageSize.pager', function(e,v){
e.stopPropagation();
c.size = parseInt(v, 10) || 10;
hideRows(table, c);
updatePageDisplay(table, c);
})
.bind('pageSet.pager', function(e,v){
e.stopPropagation();
c.page = (parseInt(v, 10) || 1) - 1;
moveToPage(table, c);
updatePageDisplay(table, c);

View File

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

View File

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