[Mapbender-commits] r7091 - trunk/mapbender/lib

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Nov 4 11:34:54 EDT 2010


Author: kmq
Date: 2010-11-04 08:34:53 -0700 (Thu, 04 Nov 2010)
New Revision: 7091

Modified:
   trunk/mapbender/lib/resultGeometryListController.js
Log:
partially undoing commit 5995 to restore 'addRowButton' functionality

Modified: trunk/mapbender/lib/resultGeometryListController.js
===================================================================
--- trunk/mapbender/lib/resultGeometryListController.js	2010-11-04 14:39:22 UTC (rev 7090)
+++ trunk/mapbender/lib/resultGeometryListController.js	2010-11-04 15:34:53 UTC (rev 7091)
@@ -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 buttonClass = "rowbutton_" +  me.rowbuttons[bId].title.replace(' ','_');
+				rowData.push('<input type="button" class="'+ buttonClass +'" value="'+ me.rowbuttons[bId].title +'"  />');
+			}
+
 			// fnAddData returns an array of indices
 			var index = me.datatable.fnAddData(rowData);
 			
@@ -172,6 +178,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
@@ -186,6 +203,7 @@
 		if(me.table != null){me.table.remove() }
 		me.table = $('<table class="display" id="'+ me.options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
 		$('#' + me.options.id).prepend(me.table);
+
 		//apply columns to table
 		//$("thead tr th",table).remove();
 		theads = "";
@@ -193,11 +211,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