[mapguide-users] Setting correct Legend checkboxes

Fredrik Ohlsson 77fredrik at gmail.com
Fri Jan 31 00:10:00 PST 2014


im using the linktoview widget for showing different layergroups. The
linktoview widget produces url's with parameter for groups to show, called

The maps then shows my layergroup correctly,
only problem is the checkbox in the legend for layergroup 'Cities' doesn't
get checked.

Im trying to fix this with javascript:

var mapWidget = Fusion.getWidgetById('MainMap');
var Maps = mapWidget.getAllMaps();

Maps[0].layerRoot.groups[2].groups[7].legend.treeItem.checkbox.checked = true;

The code is working when executed via button in toolbar, but I want
the code executed when loading the page and this will not work,
errormessage: "WARNING: Exception occurred in AJAX callback.Message:
Cannot read property 'treeItem' of undefined Location: undefined

Im guessing it has something to do with the Legend hasn't finished
loading and i have to trigger some event when the legend has finished

Am I missing something, or do I have to add my own event in legend.js
when the legend has loaded or is there some other event i could use??

Am i missing something else?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20140131/72984146/attachment.html>

More information about the mapguide-users mailing list