Skip to content

Commit ebcd127

Browse files
authored
Merge pull request #142 from kofifus/patch-1
Fix column click/sort after resize
2 parents 67f442e + c152c1c commit ebcd127

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

slick.grid.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ if (typeof Slick === "undefined") {
208208
var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' };
209209
var $hiddenParents;
210210
var oldProps = [];
211+
var columnResizeDragging = false;
211212

212213
//////////////////////////////////////////////////////////////////////////////////////////////
213214
// Initialization
@@ -771,6 +772,7 @@ if (typeof Slick === "undefined") {
771772

772773
function setupColumnSort() {
773774
$headers.click(function (e) {
775+
if (columnResizeDragging) return;
774776
// temporary workaround for a bug in jQuery 1.7.1 (http://bugs.jquery.com/ticket/11328)
775777
e.metaKey = e.metaKey || e.ctrlKey;
776778

@@ -978,6 +980,7 @@ if (typeof Slick === "undefined") {
978980
minPageX = pageX - Math.min(shrinkLeewayOnLeft, stretchLeewayOnRight);
979981
})
980982
.on("drag", function (e, dd) {
983+
columnResizeDragging = true;
981984
var actualMinWidth, d = Math.min(maxPageX, Math.max(minPageX, e.pageX)) - pageX, x;
982985
if (d < 0) { // shrink column
983986
x = d;
@@ -1061,6 +1064,7 @@ if (typeof Slick === "undefined") {
10611064
updateCanvasWidth(true);
10621065
render();
10631066
trigger(self.onColumnsResized, {grid: self});
1067+
setTimeout(function () { columnResizeDragging = false; }, 300);
10641068
});
10651069
});
10661070
}
@@ -2747,6 +2751,7 @@ if (typeof Slick === "undefined") {
27472751
}
27482752

27492753
function handleHeaderClick(e) {
2754+
if (columnResizeDragging) return;
27502755
var $header = $(e.target).closest(".slick-header-column", ".slick-header-columns");
27512756
var column = $header && $header.data("column");
27522757
if (column) {

0 commit comments

Comments
 (0)