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/04/27 21:34:27 UTC

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

Author: mturyn
Date: Fri Apr 27 14:34:26 2007
New Revision: 533232

URL: http://svn.apache.org/viewvc?view=rev&rev=533232
Log:
Reverted to sorting on click (as opposed to mouse down), and the "sort(f(a,b))/then reverse" algorithm for descending sorting---had tried to change it to "sort(f(b,a))" which feels cleaner to me, but hasn't been QA'd for months to vet it.

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=533232&r1=533231&r2=533232
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js (original)
+++ incubator/xap/trunk/codebase/src/xap/widgets/dojo/TreeTable.js Fri Apr 27 14:34:26 2007
@@ -830,32 +830,30 @@
 		
 		
 		var bSortAscending = !column._sort || column._sort=='descending' ;
-		
+
 		//sort the array and change _rows to match
-		this._rows.sort( bSortAscending?
-			sortFunction
-			:function(a,b){ return sortFunction.call(this,b,a) ; }
-		);
+		this._rows.sort( sortFunction ) ;
 		
-		if (!column._sort || column._sort=='descending'){
+		if (bSortAscending){
 			column.setSortAsc();
 			// Block resizing the table 
+			// (in the rebuildRows op.)			
 			// as a result of this sort:
 			this._justSorted = true ;			
 		}
 		else{
 			column.setSortDesc() ;
-			// This was a simple way
-			// of doing it, but a bit bogus:
-			// this._rows.reverse();
-			// altered the sort
+			this._rows.reverse();
 			
 			// Block resizing the table 
+			// (in the rebuildRows op.)
 			// as a result of this sort:
 			this._justSorted = true ;				
 			
 		}
 
+
+
 		// before we do anything set the widths of what will become the new first row of cells
 		// so IE won't freak out (fixed layout without fixed sizes in the first inserted row)
 		if (dojo.render.html.ie){
@@ -1234,8 +1232,7 @@
 	setHeader: function( xapLabel ){
 		this._header = xapLabel;
 		this.setSortNone(); 
-//		dojo.event.connect(xapLabel._rootDomNode, "onclick", this, "onClickCallback");
-		dojo.event.connect(xapLabel,"_styleMousedown",this,"onMouseDownCallback") ;
+		dojo.event.connect(xapLabel._rootDomNode, "onclick", this, "onClickCallback");
 
 		
 		// if there's an explicitly-set width in the header
@@ -1257,7 +1254,7 @@
 		this._table = table;
 	},
 
-	onMouseDownCallback : function(){
+	onClickCallback : function(){
 		if (this._table){
 			this._table.sortColumn(this);
 		}