when using BBOX or Fixed strategies, pass on the filter used in the request to the loadstart event. This is mostly important in the case of BBOX, since there is no other way to get the filter used in the request. An example use case is doing a hitCount request using the same filter to find out the true number of features matched on the server-side

This commit is contained in:
Bart van den Eijnden
2012-11-07 11:43:18 +01:00
parent c420fc6aad
commit a4df9a871b
5 changed files with 17 additions and 6 deletions

View File

@@ -112,7 +112,7 @@
function test_events(t) {
t.plan(6);
t.plan(7);
var log = [];
@@ -141,6 +141,7 @@
t.eq(log.length, 2, "2 events logged");
t.eq(log[0].type, "loadstart", "loadstart first");
t.ok(log[0].filter.type === OpenLayers.Filter.Spatial.BBOX, "loadstart includes filter used");
t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");

View File

@@ -62,7 +62,7 @@
function test_events(t) {
t.plan(6);
t.plan(7);
var log = [];
@@ -70,6 +70,11 @@
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, {
filter: new OpenLayers.Filter.Comparison({
type: '==',
property: 'foo',
value: 'bar'
}),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol({
read: function(config) {
@@ -92,6 +97,7 @@
t.eq(log.length, 2, "2 events logged");
t.eq(log[0].type, "loadstart", "loadstart first");
t.eq(log[0].filter, layer.filter, "filter passed on as argument to loadstart");
t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");