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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Dec 16 03:49:09 EST 2009


Author: kmq
Date: 2009-12-16 03:49:03 -0500 (Wed, 16 Dec 2009)
New Revision: 5192

Modified:
   trunk/mapbender/http/javascripts/mod_ResultList.js
   trunk/mapbender/lib/resultGeometryListController.js
Log:
fixed bug where changing the wfsConf would cause the resultList to break

Modified: trunk/mapbender/http/javascripts/mod_ResultList.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-15 16:38:11 UTC (rev 5191)
+++ trunk/mapbender/http/javascripts/mod_ResultList.js	2009-12-16 08:49:03 UTC (rev 5192)
@@ -36,7 +36,8 @@
 			var  args =  { 
 				WFSConf: me.WFSConf,
 				geoJSON: me.model.toString(),
-				selectedRows: me.getSelected()
+				selectedRows: me.getSelected(),
+				table: me.datatable
 			};
 			buttondef.callback.call(this,args);
 		};
@@ -102,7 +103,7 @@
 			$('#'+options.id).css("display","block");
 		}
 
-		$("tr td span.wfsFproperty",table).click(function(){
+		$("tr td span.wfsFproperty",me.table).click(function(){
 			// go up to the row, which has the "modelindex" set
 			var i = $(this.parentNode.parentNode).data("modelindex");
 			var feature = me.model.getFeature(i);
@@ -189,10 +190,10 @@
 		});
 		
 		// set style of cursor to pointer for the result table
-		$("tr td span.wfsFproperty",table).css("cursor","pointer");
+		$("tr td span.wfsFproperty",me.table).css("cursor","pointer");
 
 		// make rows selectable
-		$("tr",table).click(function () {
+		$("tr",me.table).click(function () {
 			if($(this).hasClass('row_selected')){
 				$(this).removeClass('row_selected');
 			}
@@ -224,10 +225,10 @@
 };
 
 
-var table = $('<table class="display" id="'+ options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
-$('#'+options.id).append(table);
+//var table = $('<table class="display" id="'+ options.id +'_table"><thead><tr></tr></thead><tbody></tbody></table>');
+//$('#'+options.id).append(table);
 
-ResultGeometryList.prototype = new ResultGeometryListController(table);
+ResultGeometryList.prototype = new ResultGeometryListController(options);
 ResultGeometryList.prototype.constructor = ResultGeometryList;
 
 Mapbender.modules[options.id] = $.extend(

Modified: trunk/mapbender/lib/resultGeometryListController.js
===================================================================
--- trunk/mapbender/lib/resultGeometryListController.js	2009-12-15 16:38:11 UTC (rev 5191)
+++ trunk/mapbender/lib/resultGeometryListController.js	2009-12-16 08:49:03 UTC (rev 5192)
@@ -1,6 +1,7 @@
-var ResultGeometryListController = function(table){
+var ResultGeometryListController = function(options){
 
-	// E
+	var me = this;
+	
 	// The WFSConfId this List is currently configured with
 	var WFSConf = null;
 
@@ -24,7 +25,9 @@
 
 	var me = this;
 
+	this.options = options;
 
+
 	/*
 	 * Method: addFeature
 	 * Description: adds a Feature to the Model
@@ -162,8 +165,14 @@
 		//detail columns
 		me.detailColumns = getDetailColumns(this.WFSConf);
 		
+		//var buttonrow = $('#'+me.options.id +"buttonrow")
+		$('#' + me.options.id +"_table_wrapper").remove()
+
+		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();
+		//$("thead tr th",table).remove();
 		theads = "";
 		for(i in me.columns){
 			theads += "<th>"+ me.columns[i] +"</th>";
@@ -174,7 +183,7 @@
 			theads += "<th>BUTTONCOLUMN</th>";
 		}
 		*/
-		$("thead tr",table).append(theads);
+		$("thead tr",me.table).append(theads);
 
 		//
 		// This block should optionally add the required elements in a table
@@ -185,7 +194,10 @@
 		//}
 		//table.append(heads);
 		//table.append($("<tbody></tbody>"));
-		me.datatable = table.dataTable({  
+		if (me.datatable != null){ me.datatable.remove();}
+
+		// and clear all out everythuing wtf why is there
+		me.datatable = me.table.dataTable({  
 			// see http://www.sprymedia.co.uk/dataTables/example_dom.html
 			"sDom": '<i<"resultdatatable"t>p> '
 		});
@@ -193,6 +205,7 @@
 		$(".resultdatatable table").css("width","95%");
 
 
+
 	};
 	
 



More information about the Mapbender_commits mailing list