[Chameleon] N- LegendTemplates and cwcjsapi events

Brent Lund Brent.Lund at state.mn.us
Thu Jan 4 12:07:44 EST 2007


OK - I was hoping to avoid a hack, but will do.

One legend is a typical legend. The second contains related links and
graphics (photos) which depend on the layer(s) selected.  Since its not
really a legend I may create a new container.

Thanks,
bl   

-----Original Message-----
From: Julien-Samuel Lacroix [mailto:jlacroix at mapgears.com] 
Sent: Wednesday, January 03, 2007 2:27 PM
To: Brent Lund
Cc: chameleon at lists.maptools.org
Subject: Re: [Chameleon] N- LegendTemplates and cwcjsapi events

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