[Chameleon] N- LegendTemplates and cwcjsapi events

Julien-Samuel Lacroix jlacroix at mapgears.com
Wed Jan 3 15:27:13 EST 2007


Hi,

The LegendTemplate widget is designed to support only one Legend in the 
page in JSAPI mode. You may be able to hack it to support multiple, but 
you need to be comfortable with JS code. Is there a reason why you 
display the legend twice in the same page?

Julien

PS: 34 is the widget ID. It's set in the widget code around line 316.

Brent Lund wrote:
>  
> 
> I have an application using  2 LegendTemplates.  
> 
>  
> 
>  
> 
> <cwc2 type="LegendTemplate" styleresource="TextButtons" embedded="true" 
> template="legend.html" PopupWidth="500" PopupHeight="500" 
> Toolbar="false" Status="false" Menubar="false" Visible="true" 
> Image="icons/icon_legend.png" ImageTip="Display Legend" LABEL="Legend" 
> controlvisibility="false"/>
> 
>  
> 
> <cwc2 type="LegendTemplate" styleresource="TextButtons" embedded="true" 
> template="rel_link_template.html" PopupWidth="500" PopupHeight="500"  
> Visible="true"  ImageTip="Related Links" LABEL="RelatedLinks" 
> controlvisibility="false"/>
> 
>  
> 
>  
> 
> When I change layers, the first LegendTemplate is updated but the second 
> is not updated.
> 
> Is it possible to trigger events to update more than one 
> LegendTemplate?    Looking at the script generated I’m not sure
> 
>  
> 
> function LegendTemplateWRegisterForEvent()
> 
> {
> 
>     goCWCJSAPI.RegisterEvent(LAYER_STATUS_CHANGED, "LegendTemplateWLayersChanged");
> 
>     goCWCJSAPI.RegisterEvent(LAYER_ORDER_CHANGED, "LegendTemplateWLayersChanged");
> 
>     goCWCJSAPI.RegisterEvent(MAP_NEW_LAYER_ADDED, "LegendTemplateWLayersChanged");
> 
> }
> 
> /**
> 
>  * LegendTemplateWLayersChanged
> 
>  * called when the layers are changed(JSAPI)
> 
>  */
> 
> function LegendTemplateWLayersChanged()
> 
> {
> 
>     goCWCJSAPI.ProcessLegendTemplate(34);
> 
> }
> 
>  
> 
>  
> 
> (where does 34 come from?)
> 
>  
> 
>  
> 
> thanks
> 
> Brent
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list