[OpenLayers-Users] [mapserver-users] record element in query
header
Arnd Wippermann
arnd.wippermann at web.de
Wed Apr 7 16:03:19 EDT 2010
Hi,
you can try to use javascript in your template. Below an example (it's the
whole template, nothing cut out) I use to get different colors for my table
rows.
<script>
var idx = parseInt("[lrn]")%2;
var myClass = "tdBody" + idx;
//that should only be written for the first row
if([lrn]==1)
document.write("[provincename]<hr>");
document.write("<tr class='tblBody'>");
document.write(" <td class='" + myClass + "'>[PROJEKTNUMMER]</td>");
document.write(" <td class='" + myClass + "'>[PROJEKTBEZEICHNUNG]</td>");
document.write(" <td class='" + myClass + "'>[ART][lrn]</td>");
document.write(" <td class='" + myClass + "'>[AGNR]</td>");
document.write(" <td class='" + myClass + "'>[AG]</td>");
document.write("</tr>");
</script>
Arnd
_____
Von: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] Im Auftrag von
Steve.Toutant at inspq.qc.ca
Gesendet: Mittwoch, 7. April 2010 21:15
An: Daniel Morissette
Cc: mapserver-users at lists.osgeo.org; mapserver-users-bounces at lists.osgeo.org
Betreff: Re: [mapserver-users] record element in query header
Thanks!
Here is more details on what I need to do
Suppose I have one layer which contains the province in canada and their
cities.
When the user hover or click on a province, I want this information in a
popup or a div (the client is openlayers and I use
OpenLayers.Control.WMSGetFeatureInfo)
If the user click on the province of Quebec....
There are 2000 cities in Quebec
1: city name 1
2: city name 2
...
2000: city name 2000
So In this case I think a field name should be supported in a header
template
Perhaps I misunderstood what should be managed by the client or the server??
thanks again
Steve
Daniel Morissette <dmorissette at mapgears.com>@lists.osgeo.org
Envoyé par : mapserver-users-bounces at lists.osgeo.org
07/04/2010 02:16 PM
A
mapserver-users at lists.osgeo.org
cc
Objet
Re: [mapserver-users] record element in query header
Steve.Toutant at inspq.qc.ca wrote:
>
> If I put [provincename] in the template I got the value, per example
> In the Template
> [lrn]: [provincename] - [elementname]<br>
>
> The result is:
> 1: Québec - blabla 1
> 2: Québec - blabla 2
> 3: Québec - blabla 3
>
> But I don't want to put it in the template since the same information
> will be repeated.
> thanks for your help!
I'm not exactly sure if a field name should be supported in the header
template, but based on a quick browse of the code there are two other
ways you could possibly pass the information (depending on what you have
on the client side):
1- You can use parameters from the URL in a template tag. e.g. if you
pass myprov=Quebec in the URL then you should be able to use [myprov] in
your template.
2- You can reference layer-level metadata in query templates using
[metadata_...]
(Those are untested hints based on a quick browse of the source)
Daniel
--
Daniel Morissette
http://www.mapgears.com/
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100407/07ab0234/attachment.html
More information about the Users
mailing list