Thank you Andreas, that worked. Apparently just including the code from update #406 in my LegendPanel.js wasn't enough -- I checked out revision 2606 and it works without issue.<div><br></div><div>Best,</div><div>Chris<br>
<br><div class="gmail_quote">On Tue, Feb 15, 2011 at 6:47 PM, Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
what version of GeoExt are you working with? Maybe you should just update to the latest trunk version. Because we have exactly the same use case in our applications, and it works without any problems.<br>
<br>
You should never need to trigger a legend update, it is always triggered automatically with a mergeNewParams or refresh(true) on the layer.<br>
<br>
Regards,<br>
Andreas.<br>
<div><div></div><div class="h5"><br>
On Feb 15, 2011, at 18:25 , Chris Kelley wrote:<br>
<br>
> Hi Andreas, thanks for your response.<br>
><br>
> Step (2) in my explanation is a server-side redraw of the SLD applied to the viewed layer, after which I do call layer.redraw(true) -- should have been more explicit on that. Then step (3) occurs automatically due to the layer redraw command.<br>
><br>
> I copied the code from change ticket #406 into my WMSLegend.js file, and this appears to have fixed the legend caching I reported. That's a big step forward on the problem and I appreciate the suggestion.<br>
><br>
> It seems the patch is necessary but not sufficient though, for even with this patch the legend will only update once the zoom-level is changed after a layer redraw command, whereas the map updates immediately.<br>
><br>
> I need to be able to trigger a legend refresh immediately any time a user requests an SLD update for a viewed layer, without requiring the user to manually trigger other events. A kludge for this is to clone the current bounds, zoom to max extent, and then zoom back to the cloned bounds. This is extra server traffic though that I would prefer not to have.<br>
><br>
> Do you have any advice on this?<br>
><br>
> Thanks,<br>
> Chris<br>
><br>
><br>
> On Tue, Feb 15, 2011 at 2:24 AM, Andreas Hocevar <<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>> wrote:<br>
> Hi,<br>
><br>
> What do you mean by 2. and 3.? You should call layer.redraw(true) to reload the layer.<br>
><br>
> If you do so, then you may be running into <a href="http://trac.geoext.org/ticket/406" target="_blank">http://trac.geoext.org/ticket/406</a>, which is fixed on trunk already, but was broken in 1.0.<br>
><br>
> Regards,<br>
> Andreas.<br>
><br>
><br>
>> Am 15.02.2011 03:29 schrieb "Chris Kelley" <<a href="mailto:iamchriskelley@gmail.com">iamchriskelley@gmail.com</a>>:<br>
>><br>
>><br>
>> Hi,<br>
>><br>
>> This is my first post to the GeoExt Users forum. The short question is whether you can manually trigger a legendpanel refresh or update event in javascript. The explanation is provided below.<br>
>><br>
>> Explanation:<br>
>> I have a webpage that includes a GeoExt mappanel and legendpanel that pull information from a geoserver instance on the same machine, and works perfectly for layers with static styles. I've added a form and some PHP scripts (called via AJAX) to allow the user to update the SLD file (e.g. changing the color scheme). The mappanel worked fine after adding layer.redraw(true). I don't know how to force a legendpanel update, and furthermore the legendpanel currently shows some unwanted caching.<br>
>><br>
>> As an example:<br>
>> 1. I load a map at a given zoom level<br>
>> 2. I trigger a server-side redraw of the SLD (using the Geoserver Rest API)<br>
>> 3. The webpage correctly redraws the map with the new SLD<br>
>> 4. I zoom further in on the map, and the legendpanel updates properly<br>
>> 5. I zoom back to the zoom level I was at when the SLD was updated, and the legend REVERTS to the previous legend (although the map continues to render properly).<br>
>><br>
>> I'd appreciate any help with this. Let me know if it requires any further explanation.<br>
>><br>
>> Best,<br>
>> Chris<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Users mailing list<br>
>> <a href="mailto:Users@geoext.org">Users@geoext.org</a><br>
>> <a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a><br>
>><br>
><br>
><br>
<br>
</div></div><font color="#888888">--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
<br>
</font></blockquote></div><br></div>