Skip to content

Commit 9ce30c6

Browse files
Merge pull request #16 from Recca/resize-non-sortable-column
Resize non sortable column
2 parents 9c168b9 + 4de20aa commit 9ce30c6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ColReorderWithResize.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -987,12 +987,9 @@ $.extend( ColReorder.prototype, {
987987
/* are we on the col border (if so, resize col) */
988988
if (Math.abs(e.pageX - Math.round(offset.left + nLength)) <= 5)
989989
{
990-
if (!aoColumns[i].bSortable === false || bSort === false)
991-
{
992-
$(nThTarget).css({'cursor': 'col-resize'});
993-
$(nThTarget).removeClass( tableHeaderClassname );
994-
$(nThTarget).addClass( tableHeaderHoverClassname );
995-
}
990+
$(nThTarget).css({'cursor': 'col-resize'});
991+
$(nThTarget).removeClass( tableHeaderClassname );
992+
$(nThTarget).addClass( tableHeaderHoverClassname );
996993
}
997994
else {
998995
$(nThTarget).css({'cursor': 'pointer'});
@@ -1056,6 +1053,7 @@ $.extend( ColReorder.prototype, {
10561053
this.s.mouse.nextStartWidth = $(nThNext).width();
10571054
that.dom.resize = true;
10581055
// Disable column sorting in order to avoid issues when finishing column resizing.
1056+
aoColumns[i].CRbSortableCache = aoColumns[i].bSortable;
10591057
aoColumns[i].bSortable = false;
10601058
// Disable Autowidth feature (now the user is in charge of setting column width so keeping this enabled looses changes after operations).
10611059
this.s.dt.oFeatures.bAutoWidth = false;
@@ -1339,7 +1337,7 @@ $.extend( ColReorder.prototype, {
13391337
var scrollXEnabled;
13401338

13411339
//Re-enable column sorting
1342-
this.s.dt.aoColumns[colResized].bSortable = true;
1340+
this.s.dt.aoColumns[colResized].bSortable = this.s.dt.aoColumns[colResized].CRbSortableCache;
13431341

13441342
//Save the new resized column's width
13451343
this.s.dt.aoColumns[colResized].sWidth = $(this.s.mouse.resizeElem).width() + "px";

0 commit comments

Comments
 (0)