Author: knopp
Date: Fri Nov  3 13:22:47 2006
New Revision: 471000

URL: http://svn.apache.org/viewvc?view=rev&rev=471000
Log:
one more (safety) check

Modified:
    
incubator/wicket/trunk/wicket/src/main/java/wicket/markup/html/tree/res/tree.js

Modified: 
incubator/wicket/trunk/wicket/src/main/java/wicket/markup/html/tree/res/tree.js
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/markup/html/tree/res/tree.js?view=diff&rev=471000&r1=470999&r2=471000
==============================================================================
--- 
incubator/wicket/trunk/wicket/src/main/java/wicket/markup/html/tree/res/tree.js 
(original)
+++ 
incubator/wicket/trunk/wicket/src/main/java/wicket/markup/html/tree/res/tree.js 
Fri Nov  3 13:22:47 2006
@@ -59,30 +59,35 @@
                        while (body.tagName != "DIV") {                 
                                body = body.nextSibling;
                        }
-       
-                       // get the right padding from header - we need to 
substract it from new width
-                       var padding;
-                       if (document.defaultView && 
document.defaultView.getComputedStyle) {
-                               padding = 
document.defaultView.getComputedStyle(headerParent, 
'').getPropertyValue("padding-right");
-                       } else if (headerParent.currentStyle) {
-                               padding = 
headerParent.currentStyle.paddingRight;
-                       } else {
-                               padding = 6;
-                       }
-                       
-                       padding = parseInt(padding, 10);
-                                                                       
-                       // set the new width                    
-                       var w = 
(body.getElementsByTagName("div")[0].clientWidth - padding) + "px";
-                       
-                       if (w == (-padding)+"px") { // this can happen if the 
first row is hidden (e.g. rootless mode)
-                               // try to get the width from second row         
 
-                               w = 
(body.getElementsByTagName("div")[1].clientWidth - padding) + "px";
+
+                       // last check to find out if we are updating the right 
component
+                       if (body.className == "wicket-tree-table-body") {
+
+                               // get the right padding from header - we need 
to substract it from new width
+                               var padding;
+                               if (document.defaultView && 
document.defaultView.getComputedStyle) {
+                                       padding = 
document.defaultView.getComputedStyle(headerParent, 
'').getPropertyValue("padding-right");
+                               } else if (headerParent.currentStyle) {
+                                       padding = 
headerParent.currentStyle.paddingRight;
+                               } else {
+                                       padding = 6;
+                               }
                                
-                       }
+                               padding = parseInt(padding, 10);
+                                                                               
+                               // set the new width                    
+                               var w = 
(body.getElementsByTagName("div")[0].clientWidth - padding) + "px";
+                               
+                               if (w == (-padding)+"px") { // this can happen 
if the first row is hidden (e.g. rootless mode)
+                                       // try to get the width from second row 
         
+                                       w = 
(body.getElementsByTagName("div")[1].clientWidth - padding) + "px";
+                                       
+                               }
+                                       
+                               if (w != "0px") {
+                                       header.style.width = w;
+                               }
                                
-                       if (w != "0px") {
-                               header.style.width = w;
                        }
                } catch (ignore) {                      
                }
@@ -104,3 +109,4 @@
                attached[treeTableId] = window.setInterval(function() { 
Wicket.TreeTable.update(treeTableId); }, 100);
        } 
 }
+


Reply via email to