toc.invalidateDisplayList(); toc.validateNow(); toc.validateDisplayList(); toc.invalidateSize();
Guys, Here is the solution. //Add this to the init function callLater(expandTOC); //Add this function private function expandTOC():void { toc.openItems = toc.dataProvider.source; for each(var item:TocMapLayerItem in toc.openItems) { if (item.isTopLevel()) toc.expandItem(item,true,true,true,null); } }
//Add this to the init function callLater(expandTOC); //Add this function private function expandTOC():void { toc.openItems = toc.dataProvider.source; for each(var item:TocMapLayerItem in toc.openItems) { if (item.isTopLevel()) toc.expandItem(item,true,true,true,null); } }
//Add this to the init function callLater(expandTOC); //Add this new function (make sure you don't add it inside of another function) private function expandTOC():void { if (expanded) { toc.openItems = toc.dataProvider.source; for each(var item:TocMapLayerItem in toc.openItems) { if (item.isTopLevel()) toc.expandItem(item,true,true,true,null); } } }
Leon, Because you are using the TOC in a custom component, I am not sure when you are calling the expandTOC function, but it must be getting called to soon.
Leon, Strange that you are having trouble with this... There must be a really slow map service in your map. The issue is that the Tree can not have the expand functions called before it is ready, meaning all the leafs are initialized. So if you have a very slow map service in your map then the expand function could be getting called before the tree is ready. You could try another callLater from the first callLater.Robert
mapTOC.validateNow();
Add the following in red to this code string in the config.xml within the widgets block. <widget label="Live Maps" preload="maximized" icon="com/esri/solutions/flexviewer/assets/images/icons/i_layers48.png" menu="menuMap" config="com/esri/solutions/flexviewer/widgets/LiveMapsWidget.xml">com/esri/solutions/esa/widgets/LiveMapsWidget.swf</widget>
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.