[mapguide-users] OnSelectionChanged in AJAX viewer?

Tanja Suikkanen tanja.suikkanen at dimenteq.fi
Mon Apr 28 05:29:10 EDT 2008


Ok, I sent my code snippet earlier today, but here it is again.

I got this example from
http://trac.osgeo.org/mapguide/wiki/CodeSamples/JavaScript/AJAXViewerEventHo
oking.

 

var map = parent.parent.mapFrame;

 

    var origOnSelectionChanged = null;

 

    function MySelectionHandler()

    {

        origOnSelectionChanged();

 

        var selCount = map.GetSelectedCount();

        if(selCount > 0)

        {

            My function() {}

        }

    }

 

    window.onload = function() {

        

        var timer;

 

        var watch = function() {

        

            try {

                if(map.mapInit) {

 

                    clearInterval(timer);

 

                    origOnSelectionChanged = map.OnSelectionChanged;

 

                    map.OnSelectionChanged = MySelectionHandler;

                }

            }

            catch(e) {

            }

        };

    

        timer = setInterval(watch, 200);

    };

 

Window.onload function is executed only, if I press a button.

I want to have the functionality I was telling you about without any button
clicks.

Please ask if I don't tell you enough.

 

Tanja

 

 

From: Ivan Milicevic [mailto:Ivan.Milicevic at supranet.hr] 
Sent: 28. huhtikuuta 2008 12:04
To: tanja.suikkanen at dimenteq.fi; MapGuide Users Mail List
Subject: RE: [mapguide-users] OnSelectionChanged in AJAX viewer?

 

Feature doesn't get highlighted?

 

Of course that you can add this functionality  in your own code, the logic
is same. Allwas call mapFrame functions (via JavaScript) or count selection
from C# or PHP.

 

If you want to get some help over here, be more specific.

 

Ivan.

 

From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Tanja Suikkanen
Sent: Monday, April 28, 2008 10:46 AM
To: mapguide-users at lists.osgeo.org
Subject: RE: [mapguide-users] OnSelectionChanged in AJAX viewer?

 

Ok, now it worked but some functionality had been removed?

When I first select a feature, everything goes fine but when I select
another feature, that doesn't get highlighted.

Also I wouldn't like to change the original files, just add my own
functionality in my own code files.

But thanks anyway!

 

Tanja

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080428/4b62f5d5/attachment.html


More information about the mapguide-users mailing list