[mapguide-users] Change Layer Filter in Javascript

Mauricio Villablanca mgvillablanca at yahoo.com
Fri Sep 25 20:10:12 EDT 2009




João Pereira wrote:
> 
> Hello,
> 
> I need to change the filter of a layer only in Javascript / Ajax, can´t
> use C# of php, can anyone help me.
> 
> I have try the following :
> 
> function RequestMap2(scale, centerX, centerY, idLayer)
> {
>     var reqParams = "OPERATION=GETVISIBLEMAPEXTENT&VERSION=1.0.0&SESSION="
> + sessionId + "&MAPNAME=" + encodeURIComponent(mapName) + "&SEQ=" +
> Math.random();
> 	reqParams +="&LAYER=" + idLayer + "&FILTER="+" "; 
> 	
>     mr = CreateRequestHandler();
>     req = new MapRequest(mr, ++mapId);
>     mr.open("POST", webAgent, true);
>     mr.setRequestHeader("Content-Type",
> "application/x-www-form-urlencoded");
>     mr.onreadystatechange = function()
>     {
>         if(mr.readyState == 4)
>             OnMapRequested(req, scale, centerX, centerY, mapId);
>     }
> 
>     try
>     {
>         mr.send(reqParams);
>     }
>     catch(e)
>     {
>         return;
>     }
> }
> 
> Please help, thanks.
> 

In order to set a filter you need to retrieve a layer definition, modify it,
save the map then refresh it. The 3 first steps can only be done at the
server level. You need to use either PHP or C#.

-- 
View this message in context: http://n2.nabble.com/Change-Layer-Filter-in-Javascript-tp3624682p3715624.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list