[mapguide-users] RE: Ajax Viewer Events

GM_Mizar giampiero.massa at torino.miz.it
Tue Mar 13 09:47:24 EDT 2007


Thanks a lot!

Another question coming...
with your method I can catch the OnSelectionChanged event and use my code.
Now I'm trying to get info from the map, I can use the GetSelectedCount() to
get the number of selected object, I can query the feature source
server-side but...is there a method to access data of the selected features
client-side (with javascript)? For instance, the SetProperties method of the
property panels has a parameters which is an array of couples
property-value, properties can be configured using the MapStudio in the
layer definition.

Thanks again!

Bye
GM



Scott McFarlane wrote:
> 
> GM,
> 
> I've seen several solutions to this problem on this list, but most of them
> seem to require that you modify the built-in ajax viewer template files,
> which I personally don't like to do.
> 
> As long as your status bar frame comes from the same web server as the
> viewer, and stays visible during the session, the following method should
> work. This method accomplishes the same thing as modifying the source code
> of the template files, but instead it is done at run-time. The basic
> concept
> is that you make a copy of the original OnSelectionChanged function (found
> in the main frame) and then you redefine it with your own code, which in
> turn, calls the original copied function.
> 
> In your status bar page, you can put the following JavaScript code. You'll
> need to ensure that the main frame for the ajax viewer is loaded before
> this
> code executes, so depending on how your overall page loads, this code may
> need to be wrapped into a function that waits until it knows the main
> frame
> is available.
> 
> // This needs to find the main frame of the ajax viewer
> // It depends on the relationship of this frame with other frames
> var main = parent.parent;
> 
> // Copy the original OnSelectionChanged function
> if(typeof main.osc == 'undefined')
> 	main.osc = main.OnSelectionChanged;
> 
> main.OnSelectionChanged = function()
> {
> 	// Add your code here
> 	// ...
> 
> 	// Call the original function
> 	main.osc();
> }
> 
> Hope this helps,
> 
> - Scott
> 
> -----Original Message-----
> From: mapguide-users-bounces at lists.osgeo.org
> [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of GM_Mizar
> Sent: Tuesday, March 13, 2007 5:20 AM
> To: mapguide-users at lists.osgeo.org
> Subject: [mapguide-users] Ajax Viewer Events
> 
> 
> Another time here with another boring problem, this time regarding the
> AJAX
> viewer. 
> 
> I have a status bar external to the viewer, here I can write messages for
> the user. I want to write here the description of the selected object but
> I
> want that this description changes when I select a new object in the map.
> 
> I'm trying to catch the "selection" event but I haven't found any viewer
> API
> to perform this operation. I've also checked the html code of the property
> panel, I've seen that the javascript function "SetProperties" is called
> each
> time ore or more object are selected.
> 
> I'm thinking about replacing the page of the property panel with one which
> contains the same function "SetProperties", here I can update my external
> status bar. Unfortunately this solution has two disadvantages:
> 1)	the property panel should be visible (and I don't want it)
> 2)	I have to change a file under the installation folder of the
> MapGuide
> server (exactly the
> "\WebServerExtensions\www\mapviewernet\propertyctrl.aspx"), this can
> create
> problems in deployment and maintenance of the application
> 
> Now the questions:
> 1)	can I catch the event related to the selection of an object in the
> Ajax
> Viewer?
> 2)	if not, is it possible to change the link of the page shown in the
> property panel? 
> 
> Thanks a lot for replies.
> GM
> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Ajax-Viewer-Events-tf3394731s16610.html#a9450716
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Ajax-Viewer-Events-tf3394731s16610.html#a9454796
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list