[Mapbender-commits] r5066 - trunk/mapbender/lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Dec 3 06:07:55 EST 2009
Author: kmq
Date: 2009-12-03 06:07:54 -0500 (Thu, 03 Dec 2009)
New Revision: 5066
Modified:
trunk/mapbender/lib/resultGeometryListController.js
Log:
adding new entries works
Modified: trunk/mapbender/lib/resultGeometryListController.js
===================================================================
--- trunk/mapbender/lib/resultGeometryListController.js 2009-12-03 10:23:52 UTC (rev 5065)
+++ trunk/mapbender/lib/resultGeometryListController.js 2009-12-03 11:07:54 UTC (rev 5066)
@@ -1,6 +1,5 @@
-//var geojson = {"type": "FeatureCollection", "features": [{"type":"Feature", "id":"mapbender_user.607322", "crs":{"type":"name", "properties":{"name":"http://www.opengis.net/gml/srs/epsg.xml#4326"}}, "geometry": {"type": "Point", "coordinates":[-74.0517,4.6261]}, "properties": {"gid":"746","firstname":"Diego Fabian","lastname":"Pajarito Grajales","usertype":"1","orga":"IGAC - CIAF","town":"Colombia","fullname":"www.igac.gov.co"}}];
-var ResultGeometryListController = function(options){
+var ResultGeometryListController = function(table){
// The WFSConfId this List is currently configured with
var WFSConfId = null;
@@ -8,8 +7,11 @@
// our model
var model = null;
- // a jquery obect referencing the datatable we're using
+ // a jquery object referencing the datatable we're using
var datatable = null;
+
+ // a jquery object referencing the underlying html table we're using
+ var table = table;
// the columns that should be displayed
var columns = [];
@@ -36,7 +38,7 @@
* geoJSON - a geoJSON featureCollection
*/
this.addFeatureCollection = function(geoJSON){
- var result = this.model.addFeatureCollection(geoJSON);
+ var result = model.addFeatureCollection(geoJSON);
};
/*
@@ -48,18 +50,17 @@
var addFeatureCollection_callback = function(featureEntryCollection){
// featureEntryCollection is an array of {index: <index>, feature: <feature>}
// where <index> is the index in the model, and feature a featuireCollection
-
// only add feature.properties enabled by wfsConf
- for (featureEntry in featureCollection){
+ for (featureEntry in featureEntryCollection){
//create array from featureEntries.feature here, using wfsconf
- var rowData = array("test");
+ var rowData = ["test"]//featureEntry.getValue("firstname");
// fnAddData returns an array of indices
- var index = this.datatable.fnAddData(rowData);
+ var index = datatable.fnAddData(rowData);
// this is ok because we only added a single row
- var nowNode = this.datatable.fnGetNodes(index[0]);
- $.data(rowNode,"modelindex",featuresEntry.index);
+ var rowNode = datatable.fnGetNodes(index[0]);
+ $.data(rowNode,"modelindex",featureEntry.index);
}
};
@@ -89,7 +90,7 @@
};
var getColumns = function(WfsConfId){
- return array("TESTLABEL");
+ return ["TESTLABEL"];
var currentWfsConf = global_wfsConfObj[currentWfsConfId];
var labelArray = [];
for (var j = 0 ; j < currentWfsConf.element.length ; j++) {
@@ -103,35 +104,33 @@
var reinitialize = function(){
- // clear old
- if($('#'+options.id+"_table").size() !== 0)
- {
- $('#'+options.id).remove();
- }
+ // remove all the tables children
+ //$("*",this.table).remove();
+ if( this.datatable){ this.datatable.dnClearTablea();}
-
-
// initialize new
model = new ResultGeometryListModel();
- model.events.added.register(this.addFeatureCollection_callback);
+ model.events.added.register(addFeatureCollection_callback);
model.events.deleted.register();
model.events.updated.register();
- model.events.cleared.register(this.reinitialize);
+ model.events.cleared.register(reinitialize);
- var table = $('#'+options.id).append("<table id="+ options.id+"_table" + "></table");
//create theads, and variable "labels" according to wfsConf
- this.columns = this.getColumns(this.WFSConfId);
- var heads = $("<thead></thead>");
- for (column in columns)
- {
- heads.append($("<th>"+column+"</th>"));
- }
- table.append(heads);
- this.datatable = $('#'+options.id+"_table").dataTable();
+ this.columns = getColumns(this.WFSConfId);
+ //
+ // This block should optionally add the required elements in a table
+ //var heads = $("<thead></thead>");
+ //for (column in columns)
+ //{
+ // heads.append($("<th>"+column+"</th>"));
+ //}
+ //table.append(heads);
+ //table.append($("<tbody></tbody>"));
+ datatable = table.dataTable();
};
More information about the Mapbender_commits
mailing list