<br><br>On Tuesday, May 29, 2012, Eric Lemoine wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br>On Tuesday, May 29, 2012, Alexandre Dube wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Lukas,<br>
<br>
This looks like a bug indeed. What seems to happen is the FeatureStore<br>
[addFeatures] calls loadRawData, which fires the 'load' event, which<br>
triggers [onLoad] that calls this.layer.removeAllFeatures() before<br>
adding the new ones. Writing a test to replicate what your trying to do<br>
should reproduce the issue.<br>
<br>
Without testing it and from what I understand, here's what I think could<br>
solve the problem. The [LayerStore] used to have that same issue and it<br>
was changed. The LayerModel has a static method to build new [layer<br>
model instances] that can then be added/inserted/removed with standard<br>
store methods.<br>
<br>
In brief, it should use the loadRawData method, but add instead. Would<br>
you send a pull request with a fix and tests or simply create an issue<br>
on github, please ?<br>
<br>
[addFeatures]<br>
<a href="https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L206" target="_blank">https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L206</a><br>
[onLoad]<br>
<a href="https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L319" target="_blank">https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/FeatureStore.js#L319</a><br>
[LayerStore]<br>
<a href="https://github.com/geoext/geoext2/commit/c2d5993714a4201d4c190f29eeae63b3e51d4d6e" target="_blank">https://github.com/geoext/geoext2/commit/c2d5993714a4201d4c190f29eeae63b3e51d4d6e</a><br>
[layer model instances]<br>
<a href="https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/LayerModel.js#L18" target="_blank">https://github.com/geoext/geoext2/blob/master/src/</a><a href="https://github.com/geoext/geoext2/blob/master/src/GeoExt/data/LayerModel.js#L18" target="_blank">GeoExt/data/LayerModel.js#L18</a></blockquote>
<div><br></div><div><br></div><div dir="ltr">The issue is that the onLoad listener cannot know if the load is in an “append” mode or not. So it assumes it isn't in “append” mode and unconditionally calls “removeAllFeatures” on the layer. François and I fixed the same issue in the LayerStore: <<a href="https://github.com/geoext/geoext2/commit/a4192128934e463d54e6d0bca2d6ba7187471a17" target="_blank">https://github.com/geoext/geoext2/commit/a4192128934e463d54e6d0bca2d6ba7187471a17</a>>. I think the same fix should apply to the LayerStore.</div>
</blockquote><div><br></div><div><br></div><div>Please read FeatureStore in the above sentence.<span></span></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><br></div><div dir="ltr">I won't have time to fix this myself, but I'm happy to review and merge a patch (with tests) for that :-) Thank you.<span></span></div><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="javascript:_e({}, 'cvml', 'eric.lemoine@camptocamp.com');" target="_blank">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a><br>
<br>
</blockquote><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>