From ba35969ccc13f9a64ba17b043c3b577d14a7067f Mon Sep 17 00:00:00 2001 From: jeremydawson Date: Tue, 4 Dec 2012 11:36:21 -0700 Subject: [PATCH] Update src/fr/mikrosimage/gwt/client/ResizableHeader.java Fixed bug with dragging sortable columns. After a column was sorted, it could not be dragged to the right. It was possible to drag a column to the left of the sorted column; if the sorted column was subsequently dragged back to the left of the unsorted one, the sorted column would replace the unsorted column and there would be duplicate columns in the grid. When the column is sorted, GWT inserts a div element into the table header, so getting the parent of the target element is not the table row. I simply changed the code that finds the table row to traverse the DOM until the parent tr is found. --- src/fr/mikrosimage/gwt/client/ResizableHeader.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fr/mikrosimage/gwt/client/ResizableHeader.java b/src/fr/mikrosimage/gwt/client/ResizableHeader.java index 3f7332e..b158c63 100644 --- a/src/fr/mikrosimage/gwt/client/ResizableHeader.java +++ b/src/fr/mikrosimage/gwt/client/ResizableHeader.java @@ -251,7 +251,10 @@ private ColumnMoverHelper(IDragCallback dragCallback, Element target, NativeEven this.dragCallback = dragCallback; final int clientX = event.getClientX(); columnWidth = target.getOffsetWidth(); - final Element tr = target.getParentElement(); + Element tr = target.getParentElement(); + while (!tr.getNodeName().equals("TR")) { + tr = tr.getParentElement(); + } final int columns = tr.getChildCount(); columnXPositions = new int[columns + 1]; columnXPositions[0] = tr.getAbsoluteLeft();