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 mt...@apache.org on 2007/05/25 17:43:18 UTC

svn commit: r541736 - /incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js

Author: mturyn
Date: Fri May 25 10:43:17 2007
New Revision: 541736

URL: http://svn.apache.org/viewvc?view=rev&rev=541736
Log:
(From M. Mikhaylov:)
Fixed logic in TreeTable::setSelected(), added a TableRow::deselect() method to help implement it.

Also:  commented out a command and some methods only used in debugging, altered a commnet.

Modified:
    incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js

Modified: incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js?view=diff&rev=541736&r1=541735&r2=541736
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Fri May 25 10:43:17 2007
@@ -125,8 +125,8 @@
 		if( !this._tableLayoutModel ){
 			this._tableLayoutModel = {} ;
 		}	
-// debugging
-window.foo = this ;
+// debugging:
+// window.foo = this ;
 	},		
 	
 	
@@ -1161,6 +1161,20 @@
 	 	return true;
 	 },
 	 
+	 // remove from selected items
+	 deselectRow: function(row) {
+	 	var items = this._selectedItems;
+	 	if(items.length === 0) { return; }
+	 	for (var i = 0; i < items.length; i++) {
+	 		if(items[i] == row) {
+	 			dojo.html.removeClass(row.domNode, this._selectedRowClass);
+	 			this.onDeselectRow(row);
+	 			items.splice(i, 1);
+	 		}
+	 	}
+	 },	 
+	 
+	 
 	 selectRowByUser: function(row){   //debug::this.loggit(' selectRowByUser') ;
 	 	if (this.selectRow(row)){
 	 		this.onSelectRow(row);
@@ -1192,8 +1206,9 @@
 	 },
 	 
 	 isSelected: function(row){   //debug::this.loggit(' isSelected') ;
-	 	return (xap.util.ArrayHelper.indexOf(this._selectedItems,row)>=0);
-	 },
+	 	var result = xap.util.ArrayHelper.indexOf(this._selectedItems,row) >= 0;
+	 	return result;
+ 	 },
 	 
 
 
@@ -1873,7 +1888,7 @@
 	_alterSizerMethods: function(){
 	    this.columnsSizer._addSizer=function() {
 	    // Altered so that the sizer won't flash
-	    // on creation:
+	    // as much on creation:
 	        var i = this.sizers.length;
 	
 	        this.sizers[i] = document.createElement('div');
@@ -2178,10 +2193,20 @@
 	    // occurs
 	    // ALSO we need to write back to the Xml element when the user selects or de-selects
 	    // a row.
-		this._selected = selected;
-		if (this._table && selected){
-			this._table.selectRow(this);
-		}
+	    if( (selected != this._lastSelected) ) {
+			this._lastSelected = selected;
+	    	if (this._table) {
+	    		if(selected === true) {
+		    		this._table.selectRow(this);
+		    		return;
+	    		}
+	    		if(selected === false) {
+	    			this._table.deselectRow(this);
+	    			delete this._lastSelected;
+	    			return;
+	    		}
+	    	}
+	    }
 	},
 	
 	//if we set to invis, set all children to invis as well
@@ -2245,7 +2270,7 @@
 
 
 //Debugging:
-
+/*
 xap.widgets.dojo.TreeTable.prototype.getWidths = function(){
 
     var s = "width\tdom\tscroll\ttable\ttbody\theaderDiv\theaderTable" ;
@@ -2327,3 +2352,4 @@
     prompt("",s);
 
 }
+*/
\ No newline at end of file