<br><br>On Monday, November 28, 2011, matth1as <<a href="mailto:mnick86@gmail.com">mnick86@gmail.com</a>> wrote:<br>> Hi, I have the following Problem: I have a Vector Layer with Strategy Fixed,<br>> Protocol HTTP along with some Parameters which are returned by a function:<br>
><br>> var opts = {<br>> projection: map.displayProjection,<br>> strategies: [new OpenLayers.Strategy.Fixed()],<br>> protocol: new OpenLayers.Protocol.HTTP({<br>> url: "nodes.gojson.php",<br>
> format: new OpenLayers.Format.GeoJSON({}),<br>> params: {'day':getSelectedDay(), 'month':getSelectedMonth(),<br>> 'year':getSelectedYear()},<br>> readWithPOST:true<br>> })<br>> };<br>
> sundials = new OpenLayers.Layer.Vector("KML", opts);<br>><br>> This works as expected, the POST request contains the parameters (e.g.<br>> day=1, month=2, year=2011).<br>><br>> A few seconds later, I change day=10,month=12,year=2012 and call<br>
> sundials.refresh() to refresh the vector layer.<br>><br>> But here is the Problem, the new request contains the old values (1,2,2011)<br>> ?!<br><br>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'.<br>
<br>Cheers,<br><br>-- <br>Eric Lemoine<br><br>Camptocamp France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac, Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com">http://www.camptocamp.com</a><br><br>