[Users] How to update LegendPanel after changing layer's styleMap property

Andreas Hocevar ahocevar at opengeo.org
Sat Jan 14 22:44:39 CET 2012


Hi,

there is currently no good way to keep a VectorLegend in sync with a
vector layer. You would have to call the non-API setRules() method on
the VectorLegend:

var vectorLegend = legendPanel.findBy(function(c) {
    return c.layer === myLayer
});
vectorLegend.setRules(); // Warning! Not part of the API
vectorLegend.update();

Andreas.

On Wed, Jan 11, 2012 at 1:40 PM, Pou Pou <pouniok at hotmail.com> wrote:
> Hi,
>
>
>
>
> In my application, I need to let users add vector layers. The layer's data
> depends on many user choices, and if they change one filter, I need to
> reload the data for the current vector layer.
>
>
> To change the colors and legend, I just apply a new styleMap on my layer in
> this way : Ext.apply(myLayer, {styleMap: myNewStyleMap});
>
>
> Then, I need to update the legendPanel, so it can display the new styleMap
> rules, but I don't know how to do that. I tried legendpanel update, layer
> refresh, layerstore reload, but nothing worked.
>
>
>
>
> Is there a better way to change styleMap / rules on a layer, so the legend
> panel will be updated ?
>
>
> Or is there a way to update the legend panel manually ?
>
>
>
>
>
>
> Thanks for reading me,
> Pouniok.
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list