On Monday, November 28, 2011, matth1as <[email protected]> wrote: > Hi, I have the following Problem: I have a Vector Layer with Strategy Fixed, > Protocol HTTP along with some Parameters which are returned by a function: > > var opts = { > projection: map.displayProjection, > strategies: [new OpenLayers.Strategy.Fixed()], > protocol: new OpenLayers.Protocol.HTTP({ > url: "nodes.gojson.php", > format: new OpenLayers.Format.GeoJSON({}), > params: {'day':getSelectedDay(), 'month':getSelectedMonth(), > 'year':getSelectedYear()}, > readWithPOST:true > }) > }; > sundials = new OpenLayers.Layer.Vector("KML", opts); > > This works as expected, the POST request contains the parameters (e.g. > day=1, month=2, year=2011). > > A few seconds later, I change day=10,month=12,year=2012 and call > sundials.refresh() to refresh the vector layer. > > But here is the Problem, the new request contains the old values (1,2,2011) > ?!
Yes, because your getSelected* functions are called once, when the "params" object is created. To change params after the creation of the HTTP protocol do layer.protocol.params.day = 'new day'. Cheers, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
