]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix too wide Table columns while sorting from init (#13517)
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Mon, 31 Mar 2014 14:21:12 +0000 (17:21 +0300)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Thu, 3 Apr 2014 13:36:26 +0000 (13:36 +0000)
Change-Id: I2c356c539541381e744c8960d00aa3e018beb67d

client/src/com/vaadin/client/ui/VScrollTable.java
client/src/com/vaadin/client/ui/table/TableConnector.java

index 7c22fa219906daf3d7c574482f480b561c15c8f6..261c50b73bf177309f5c0e2386fbd64c7c0f6318 100644 (file)
@@ -1130,6 +1130,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
         // cell to accomodate for the size of the sort arrow.
         HeaderCell sortedHeader = tHead.getHeaderCell(sortColumn);
         if (sortedHeader != null) {
+            // Mark header as sorted now. Any earlier marking would lead to
+            // columns with wrong sizes
+            sortedHeader.setSorted(true);
             tHead.resizeCaptionContainer(sortedHeader);
         }
         // Also recalculate the width of the captionContainer element in the
@@ -3329,11 +3332,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
 
                 if (col.hasAttribute("sortable")) {
                     c.setSortable(true);
-                    if (cid.equals(sortColumn)) {
-                        c.setSorted(true);
-                    } else {
-                        c.setSorted(false);
-                    }
+                    c.setSorted(false);
                 } else {
                     c.setSortable(false);
                 }
index e8b14955ed990923b87965d8b007f5233218de75..4d7d3c6277b90ea14e5a360dba8b37d1305cf9d4 100644 (file)
@@ -303,9 +303,13 @@ public class TableConnector extends AbstractHasComponentsConnector implements
         getWidget().tabIndex = getState().tabIndex;
         getWidget().setProperTabIndex();
 
-        if (getWidget().initializedAndAttached) {
-            getWidget().resizeSortedColumnForSortIndicator();
-        }
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+
+            @Override
+            public void execute() {
+                getWidget().resizeSortedColumnForSortIndicator();
+            }
+        });
 
         // Remember this to detect situations where overflow hack might be
         // needed during scrolling