[Mapbender-commits] r5950 - in trunk/mapbender: http/javascripts lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Apr 14 07:30:19 EDT 2010


Author: kmq
Date: 2010-04-14 07:30:16 -0400 (Wed, 14 Apr 2010)
New Revision: 5950

Modified:
   trunk/mapbender/http/javascripts/mod_ResultList.js
   trunk/mapbender/lib/resultGeometryListController.js
Log:
add the ability to add buttons to an extra column for each row in the resultList

Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	2010-04-13 15:14:53 UTC (rev 5949)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2010-04-14 11:30:16 UTC (rev 5950)
@@ -128,7 +128,7 @@
 	this.addPopupButton = function(buttondef){
 		this.popupButtons.push(buttondef);
 	};
-	
+
 	/*
 	 * Method : setTitle
 	 *
@@ -189,6 +189,15 @@
 					me.rowmouseout.trigger((function(){return row;})());
 				});
 				
+
+				for(bId in me.rowbuttons){
+					var callback  = me.rowbuttons[bId].callback;
+					var class = "rowbutton_" + me.rowbuttons[bId].title.replace(' ','_');
+					$("."+class, row).click(function(){
+						callback((function(){ return row;})());
+					});
+				}
+				
 				// make rows selectable only when there are Global Buttons that could actually do something with that selection
 				if($('#'+options.id+"buttonrow").length >  0){
 					$(row).click((function(){
@@ -218,12 +227,7 @@
 	};
 
 	if(display_popup){
-		$('#'+options.id).dialog({autoOpen: false , 
-								width:options.resultListWidth, 
-//								height:options.resultListHeight, 
-								draggable: true, 
-								title: options.resultListTitle, 
-								position: options.position});
+		$('#'+options.id).dialog({autoOpen: false , width:options.resultListWidth, height:options.resultListHeight, draggable: true, title: options.resultListTitle, position: options.position});
 	}
 	else{
 		$('#'+options.id).css("display","none");

Modified: trunk/mapbender/lib/resultGeometryListController.js
===================================================================
--- trunk/mapbender/lib/resultGeometryListController.js	2010-04-13 15:14:53 UTC (rev 5949)
+++ trunk/mapbender/lib/resultGeometryListController.js	2010-04-14 11:30:16 UTC (rev 5950)
@@ -21,7 +21,7 @@
 	this.detailColumns = [];
 
 	// array of buttondef objects
-	this.buttoncolumns = []
+	this.rowbuttons = []
 
 	this.options = options;
 
@@ -75,6 +75,12 @@
 				rowData.push(cellContent);
 			}
 
+			for(bId in me.rowbuttons){
+				var callback  = me.rowbuttons[bId].callback;
+				var class = "rowbutton_" +  me.rowbuttons[bId].title.replace(' ','_');
+				rowData.push('<input type="button" class="'+ class +'" value="'+ me.rowbuttons[bId].title +'"  />');
+			}
+
 			// fnAddData returns an array of indices
 			var index = me.datatable.fnAddData(rowData);
 			
@@ -162,6 +168,17 @@
 		}
 	};
 
+
+	/*
+	 * Method: addRowButton
+	 * Description: adds a Button to each row
+	 * Parameters:
+	 * buttondef: {Object} an object with  properties: "title" and  "callback", a function that gets the  feature that corresponds to the popup as it's argument
+  */
+	this.addRowButton = function(buttondef){
+		this.rowbuttons.push(buttondef);
+	}
+
 	this.reinitialize = function(){
 		
 		//create theads, and variable "labels" according to wfsConf
@@ -183,11 +200,12 @@
 			theads += "<th>"+ me.columns[i].label +"</th>";
 			
 		}
-		/*
-		for (i in me.buttoncolumns){ 
-			theads += "<th>BUTTONCOLUMN</th>";
+
+    
+		for (i in this.rowbuttons){ 
+			theads += "<th></th>";
 		}
-		*/
+
 		$("thead tr",me.table).append(theads);
 
 		//



More information about the Mapbender_commits mailing list