Reviewers: rchandia,

Description:
Detaching the table section in CellTable before setting the innerHTML to
replace the rows. This is a well known performance enhancement that
CellTable isn't taking advantage of.


Please review this at http://gwt-code-reviews.appspot.com/1443805/

Affected files:
  M user/src/com/google/gwt/user/cellview/client/CellTable.java


Index: user/src/com/google/gwt/user/cellview/client/CellTable.java
===================================================================
--- user/src/com/google/gwt/user/cellview/client/CellTable.java (revision 10206) +++ user/src/com/google/gwt/user/cellview/client/CellTable.java (working copy)
@@ -116,6 +116,7 @@
     /**
      * The styles used in this widget.
      */
+    @Override
     @Source(BasicStyle.DEFAULT_CSS)
     BasicStyle cellTableStyle();
   }
@@ -425,8 +426,16 @@
         DOM.setEventListener(table.getElement(), table);
       }

+      // Remove the section from the tbody.
+      Element parent = section.getParentElement();
+      Element nextSection = section.getNextSiblingElement();
+      section.removeFromParent();
+
       // Render the html.
       section.setInnerHTML(html.asString());
+
+      // Reattach the section.
+      parent.insertBefore(section, nextSection);

       // Detach the event listener.
       if (!table.isAttached()) {
@@ -644,6 +653,7 @@

     // Create the ColumnSortList and delegate.
     sortList = new ColumnSortList(new ColumnSortList.Delegate() {
+      @Override
       public void onModification() {
         if (!updatingSortList) {
           createHeaders(false);
@@ -1601,6 +1611,7 @@
       TableCellElement td = tr.getCells().getItem(keyboardSelectedColumn);
final com.google.gwt.user.client.Element cellParent = getCellParent(td).cast(); CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() {
+        @Override
         public void execute() {
           cellParent.focus();
         }
@@ -1871,6 +1882,7 @@
       cellIsEditing = cell.isEditing(context, parentElem, cellValue);
       if (cellWasEditing && !cellIsEditing) {
CellBasedWidgetImpl.get().resetFocus(new Scheduler.ScheduledCommand() {
+          @Override
           public void execute() {
             setFocus(true);
           }


--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to