PDA

View Full Version : How to clear the request string for dataset


productengine
09-11-2003, 08:28 AM
How can I clear the request string for dataset? The problem is that after setting some request parameters to dataset and calling doRequest() method, these parameters don't disappear.
For example:
1) after this code
canvas.datasets.d.setQueryParams({key1:"value1",key2:"value2"});
canvas.datasets.d.doRequest();

2) next request appears

http://localhost:8080/path-to-servlet/servletname?key1=value1&key2=value2

3) then next code executes

canvas.datasets.d.setQueryParams({key3:"value3",key4:"value3"});
canvas.datasets.d.doRequest();

4) and next request appears

http://localhost:8080/path-to-servlet/servletname?key1=value1&key2=value2&key3=value3&key4=value4

5) But I don't set key1=value1&key2=value2 on step 3 and don't need to send it on step 3.

antun
09-11-2003, 09:00 AM
I'm not sure how to do it with setQueryParams, but if you want you can use setQueryString() to set the querystring to an empty string. I would recommend building the paramaters up as a string in the first place if you're going to do this:


<canvas debug="true">
<debug x="200" />
<dataset name="d" src="http://www.laszlosystems.com/cgi-pub/weather.cgi"
autorequest="false" />

<button>
<method event="onclick">
var d = canvas.datasets.d;
d.setQueryString('param1=value1&amp;param2=value2');
d.doRequest();

debug.write( "BEFORE: " + d.getQueryString() );
d.setQueryString('');

d.setQueryString('param3=value3&amp;param4=value4');
d.doRequest();

debug.write( "AFTER: " + d.getQueryString() );
</method>
</button>
</canvas>


-Antun