Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"Flexible Web Layout Example 2: Selections" generates error

1 REPLY 1
SOLVED
Reply
Message 1 of 2
dajvid
1401 Views, 1 Reply

"Flexible Web Layout Example 2: Selections" generates error

Hi,

 

I'm testing "Example 2: Selections" in the "Flexible Web Layout Examples":

 

http://wikihelp.autodesk.com/Infr._Map_Server/enu/2013/Help/0005-Develope0/0105-Flexible105/0112-Exa...

 

Testing the Example2.js provided, a javascript error is generated on the following line:

 

var oSelection = selection[theMap.getMapName()];

The error generated is:

 

Fusion Error:
WARNING: Exception occurred in AJAX callback.
Message: getMapName is not a function

 

The same code appears in 

 

http://wikihelp.autodesk.com/Infr._Map_Server/enu/2013/Help/0005-Develope0/0094-Flexible94/0100-Work...

 

What is the correct code for working with selections?

 

Kind regards,
Dave.

1 REPLY 1
Message 2 of 2
jackie.ng
in reply to: dajvid

Oh dear! Someone changed the API and failed to document this!

 

Anyway, here's how you can get the map name.

 

//Gets the MapGuide map name from the map widget
//
//theMap: The Fusion.Widget.Map instance
function getMapName(theMap) {
//subMaps will be an array of Fusion.Layers instances (of which Fusion.Layers.MapGuide is a subclass of) var subMaps = theMap.getAllMaps(); for (var i = 0; i < subMaps.length; i++) { if (subMaps[i].arch == "MapGuide") { //Is a Fusion.Layers.MapGuide object return subMaps[i].getMapName(); //Map name is here } } return null; }

Unless you have some strange multi-map setup, the subMaps array will generally have at most one Fusion.Layers.MapGuide instance, so you just find that instance (using the .arch property to determine the correct sub-type) and get the map name from that instance.

 

 - Jackie

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report