ColReorderWithResize
ColReorderWithResize copied to clipboard
Resizing a column causes sorting by that column
When a resize is finished, a "click" event is triggered, which causes a resorting for the column. Is it possible to avoid it?
+1 The funny part is, that only when I move the column to the left side - to make the column smaller - is causing the sort/refresh. But, when I move it right - is it working good.
If it helps, I was able to work around this issue like this:
var resizing = false;
jQuery(document).ready(function() {
jQuery('#table th').on('click.DT', function(e) {
// if we have just resized, prevent datatables sort handler from running.
if (resizing) {
e.stopImmediatePropagation();
}
});
jQuery('#table').on('column-resize.dt.mouseup', function() {
// set global flag that we have just resized.
resizing = true;
// and clear after some small amount of time.
setTimeout(function() { resizing = false; }, 100);
});
});
Same problem for me an fix from SpikedCola fixes it. Thanks!