You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2006/09/18 23:08:17 UTC
svn commit: r447627 - /incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js
Author: jmargaris
Date: Mon Sep 18 16:08:17 2006
New Revision: 447627
URL: http://svn.apache.org/viewvc?view=rev&rev=447627
Log:
now expand/contract working ok in both browsers, sizing mostly ok
Modified:
incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js
Modified: incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js?view=diff&rev=447627&r1=447626&r2=447627
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/src/xap/widgets/dojo/TreeTable.js Mon Sep 18 16:08:17 2006
@@ -242,6 +242,7 @@
xap.widgets.dojo.TableRow = function(){
dojo.widget.HtmlWidget.call(this);
this._rows = [];
+ this._expanded = true;
}
@@ -272,18 +273,37 @@
setDepth : function( depth ){
this._depth = depth;
if (this._indentSpan){
- var spacerText = "";
- for (var i = 0; i<depth; i++){
- spacerText +="x"
+ dojo.html.addClass(this._indentSpan, "ImgNodeExpanded");
+ this._indentSpan.style.marginLeft = (depth*10)+"px";
+ this._indentSpan.innerHTML = " ";
+ dojo.event.connect(this._indentSpan, "onclick", this, "onExpand");
+ }
+ },
+
+ onExpand : function( ){
+ this._expanded = !this._expanded;
+ for (var i = 0; i<this._rows.length; i++){
+ this._rows[i].setVisible(this._expanded);
+ }
+ },
+
+ //if we set to invis, set all children to invis as well
+ //if we set it back, set children back ONLY if we are expanded!
+ setVisible : function (visible){
+ var visibility = visible ? "visible":"hidden";
+
+ //IMPORTANT
+ //if you use static here on IE you can't click on the node
+ //afterwards sometimes. If you use relative you can but then
+ //scrolling gets messed up. It seems like jiggering the row a bit,
+ //for example by changing the height works. Need a good solution here
+ var position = visible ? "static":"absolute";
+ this.domNode.style.visibility = visibility;
+ this.domNode.style.position = position;
+ for (var i = 0; i<this._rows.length; i++){
+ if (!visible || this._expanded){
+ this._rows[i].setVisible(visible);
}
- var text = document.createTextNode(spacerText);
- this._indentSpan.appendChild(text);
- var image = document.createElement("span");
- this._indentSpan.appendChild(image);
- dojo.html.addClass(image, "ImgNodeExpanded");
- image.style.width="16px";
- image.style.height="16px";
- image.innerHTML = " ";
}
},