Fix resizable widget bindings after tablesorter updateAll event

After updating tablesorter with updateAll event it will reinitalize all widget, but resizable initalized only once internally and there after it was not possible to change columns widths.
This commit is contained in:
Gabor Gyorvari 2015-11-04 19:05:17 +01:00
parent 73153f2bdf
commit b73162d0c0

View File

@ -102,10 +102,8 @@
.bind( 'selectstart', false ); .bind( 'selectstart', false );
} }
} }
$table.one('tablesorter-initialized', function() { ts.resizable.setHandlePosition( c, wo );
ts.resizable.setHandlePosition( c, wo ); ts.resizable.bindings( c, wo );
ts.resizable.bindings( this.config, this.config.widgetOptions );
});
}, },
updateStoredSizes : function( c, wo ) { updateStoredSizes : function( c, wo ) {
@ -188,9 +186,9 @@
}, },
// prevent text selection while dragging resize bar // prevent text selection while dragging resize bar
toggleTextSelection : function( c, toggle ) { toggleTextSelection : function( c, wo, toggle ) {
var namespace = c.namespace + 'tsresize'; var namespace = c.namespace + 'tsresize';
c.widgetOptions.resizable_vars.disabled = toggle; wo.resizable_vars.disabled = toggle;
$( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle ); $( 'body' ).toggleClass( ts.css.resizableNoSelect, toggle );
if ( toggle ) { if ( toggle ) {
$( 'body' ) $( 'body' )
@ -227,7 +225,7 @@
vars.mouseXPosition = event.pageX; vars.mouseXPosition = event.pageX;
ts.resizable.updateStoredSizes( c, wo ); ts.resizable.updateStoredSizes( c, wo );
ts.resizable.toggleTextSelection( c, true ); ts.resizable.toggleTextSelection(c, wo, true );
}); });
$( document ) $( document )
@ -246,7 +244,7 @@
}) })
.bind( 'mouseup' + namespace, function() { .bind( 'mouseup' + namespace, function() {
if (!wo.resizable_vars.disabled) { return; } if (!wo.resizable_vars.disabled) { return; }
ts.resizable.toggleTextSelection( c, false ); ts.resizable.toggleTextSelection( c, wo, false );
ts.resizable.stopResize( c, wo ); ts.resizable.stopResize( c, wo );
ts.resizable.setHandlePosition( c, wo ); ts.resizable.setHandlePosition( c, wo );
}); });
@ -351,7 +349,7 @@
.unbind( 'contextmenu' + namespace ); .unbind( 'contextmenu' + namespace );
wo.$resizable_container.remove(); wo.$resizable_container.remove();
ts.resizable.toggleTextSelection( c, false ); ts.resizable.toggleTextSelection( c, wo, false );
ts.resizableReset( table, refreshing ); ts.resizableReset( table, refreshing );
$( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace ); $( document ).unbind( 'mousemove' + namespace + ' mouseup' + namespace );
} }