<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: TOC Control - expand at startup in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248488#M5892</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I called mapTOC.ExpandChildrenOf(....) in the mapLoadComplete function and success! ... or so I thought.&amp;nbsp; It worked for a little while, until I exported to release build and the TOC no longer expanded.&amp;nbsp; I must have been getting lucky with timing of the map finishing loading the TOC being populated when I was running it from Flex Builder.&amp;nbsp; Weird.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried ValidateNow() in the config function and it seems to really screw up the load process.&amp;nbsp; My services don't appear, unless I manually zoom and my disclaimer window is off centered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 07 May 2010 19:10:18 GMT</pubDate>
    <dc:creator>LeonScott</dc:creator>
    <dc:date>2010-05-07T19:10:18Z</dc:date>
    <item>
      <title>TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248481#M5885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want the TOC control to be expanded on startup of my app based on the Sample Flex Viewer.&amp;nbsp; I've tried calling expandChildrenOf() and expandItem() methods for the control in the config function of the MapManager, but its had no effect.&amp;nbsp; Any ideas?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 18:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248481#M5885</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-05T18:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248482#M5886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Add the following in red to this code string in the config.xml within the widgets block.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;widget label="Live Maps" &lt;/SPAN&gt;&lt;STRONG&gt;preload="maximized"&lt;/STRONG&gt;&lt;SPAN&gt; icon="com/esri/solutions/flexviewer/assets/images/icons/i_layers48.png" menu="menuMap" config="com/esri/solutions/flexviewer/widgets/LiveMapsWidget.xml"&amp;gt;com/esri/solutions/esa/widgets/LiveMapsWidget.swf&amp;lt;/widget&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 May 2010 18:34:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248482#M5886</guid>
      <dc:creator>MarcCavallaro</dc:creator>
      <dc:date>2010-05-05T18:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248483#M5887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response. I'm not using the LiveMapsWidget though. I've placed the TOC component in the MapManager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Add the following in red to this code string in the config.xml within the widgets block.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;&amp;lt;widget label="Live Maps"&amp;nbsp;&amp;nbsp; &lt;SPAN style="color:&amp;quot;Red&amp;quot;;"&gt;&lt;STRONG&gt;preload="maximized"&lt;/STRONG&gt;&lt;/SPAN&gt; icon="com/esri/solutions/flexviewer/assets/images/icons/i_layers48.png" menu="menuMap" config="com/esri/solutions/flexviewer/widgets/LiveMapsWidget.xml"&amp;gt;com/esri/solutions/esa/widgets/LiveMapsWidget.swf&amp;lt;/widget&amp;gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 15:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248483#M5887</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-06T15:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248484#M5888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bluesalmon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Is it possible that you are trying to call the expand method before the tree is populated? That would be the first thing I would check.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 19:06:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248484#M5888</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-05-06T19:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248485#M5889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm calling it at the very end of the config function, like this.&amp;nbsp; The layers are getting added to the map prior this in the same function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//config&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;private function config(event:AppEvent):void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Populate TOC control w/ live layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapTOC.map = map;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapTOC.excludeLayers = getBasemaps();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapTOC.excludeGraphicsLayers = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mapTOC.expandChildrenOf(mapTOC.firstVisibleItem, true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, I read this in the Flex Language Reference that might be part of the issue:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you set dataProvider and then immediately call expandChildrenOf() you may not see the correct behavior. You should either wait for the component to validate or call the validateNow() method. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the responses!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 11:46:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248485#M5889</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-07T11:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248486#M5890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bluesalmon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; So have you tried the validatenow? Maybe validatenow in combination with CallLater.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 11:52:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248486#M5890</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-05-07T11:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248487#M5891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried different combinations of ValidateNow() and CallLater() with no results.&amp;nbsp; You were right though, I was calling it in the wrong place.&amp;nbsp; I call mapTOC.ExpandChildrenOf(....) in the mapLoadComplete function and success!&amp;nbsp; So I end up with something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;private function config(event:AppEvent):void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; map.addEventListener(MapEvent.Load, mapLoadComplete);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; // Populate TOC control w/ live layers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; mapTOC.map = map;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; mapTOC.excludeLayers = getBasemaps();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; mapTOC.excludeGraphicsLayers = true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;//map load complete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;private function mapLoadComplete(event:MapEvent):void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; SiteContainer.dispatchEvent(new AppEvent(AppEvent.LAYER_LOADED, false, false, null));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; mapTOC.expandChildrenOf(mapTOC.firstVisibleItem, true);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 12:33:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248487#M5891</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-07T12:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248488#M5892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I called mapTOC.ExpandChildrenOf(....) in the mapLoadComplete function and success! ... or so I thought.&amp;nbsp; It worked for a little while, until I exported to release build and the TOC no longer expanded.&amp;nbsp; I must have been getting lucky with timing of the map finishing loading the TOC being populated when I was running it from Flex Builder.&amp;nbsp; Weird.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried ValidateNow() in the config function and it seems to really screw up the load process.&amp;nbsp; My services don't appear, unless I manually zoom and my disclaimer window is off centered.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 19:10:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248488#M5892</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-07T19:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248489#M5893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Are you calling the validate now on the toc control?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mapTOC.validateNow();&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 May 2010 19:48:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248489#M5893</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-05-07T19:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248490#M5894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that is how I called ValidateNow.&amp;nbsp; I'm trying to think of where the best place to call mapTOC.expandChildrenOf() or perhaps a listener of some sort is needed.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 11:59:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248490#M5894</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-05-12T11:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248491#M5895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;has anyone come up with a resolution for this? This is something I was looking into also&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Aaron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jun 2010 12:25:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248491#M5895</guid>
      <dc:creator>AaronNash</dc:creator>
      <dc:date>2010-06-23T12:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248492#M5896</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Here is the solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Add this to the init function
callLater(expandTOC);

//Add this function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private function expandTOC():void
&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.openItems = toc.dataProvider.source;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each(var item:TocMapLayerItem in toc.openItems) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.isTopLevel())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.expandItem(item,true,true,true,null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:21:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248492#M5896</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T12:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248493#M5897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Guys,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Here is the solution.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Add this to the init function
callLater(expandTOC);

//Add this function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private function expandTOC():void
&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.openItems = toc.dataProvider.source;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each(var item:TocMapLayerItem in toc.openItems) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.isTopLevel())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.expandItem(item,true,true,true,null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Are you meaning the MapManager init?&amp;nbsp; I tried adding this and nothing happens.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;EDIT: never mind I got this fixed!&amp;nbsp; Since my TOC code wasn't in MapManager I had to move it!&lt;/STRONG&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248493#M5897</guid>
      <dc:creator>JacksonTrappett</dc:creator>
      <dc:date>2021-12-11T12:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248494#M5898</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've tried this solution as your suggested, but the TOC still isn't expanding for some reason.&amp;nbsp; Unfortunately, I haven't gotten very far on this issue lately.&amp;nbsp; It would be a nice feature to have, but I didn't want to get hung up on it.&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Guys,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Here is the solution.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//Add this to the init function
callLater(expandTOC);

//Add this function
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private function expandTOC():void
&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.openItems = toc.dataProvider.source;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for each(var item:TocMapLayerItem in toc.openItems) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.isTopLevel())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.expandItem(item,true,true,true,null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:21:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248494#M5898</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2021-12-11T12:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248495#M5899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Robert&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jun 2010 14:21:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248495#M5899</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-06-28T14:21:48Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248496#M5900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is a possibility...&amp;nbsp; I don't notice it being particularly slow to load.&amp;nbsp; I load a few basemaps and an "overlay layer" in my app.&amp;nbsp; I thought that number of services might contribute to what you are talking about.&amp;nbsp; So far I've tested not loading the basemaps.&amp;nbsp; I'll fiddle with overlay to see if that makes a difference.&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Its online @ &lt;/SPAN&gt;&lt;A href="http://gis.dedham-ma.gov/propertyviewer"&gt;http://gis.dedham-ma.gov/propertyviewer&lt;/A&gt;&lt;SPAN&gt;, if you would like to see what I'm doing with the basemaps.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Leon,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; 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.&lt;BR /&gt;&lt;BR /&gt;Robert&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jun 2010 14:58:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248496#M5900</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-06-28T14:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248497#M5901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Leon,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 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.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jun 2010 15:22:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248497#M5901</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-06-28T15:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248498#M5902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have tried calling it in both init() and config() with similar results. I also tried calling it in the mapLoadcomplete() function at one point, but I didn't use the callLater() function. That made the difference. Before I was trying to expand the tree without the use of callLater in the same spot, so like you said it was getting called too soon. Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Leon&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FYI - I am defining the TOC control in the MapManager.mxml like this....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size:&amp;quot;1&amp;quot;;"&gt;&amp;lt;mx:HBox id="mainBox" width="100%" height="100%" &amp;gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt; &amp;lt;!-- Place Live Maps in Right Panel.... replaces LiveMapsWidget --&amp;gt;&lt;BR /&gt; &amp;lt;mx:VBox width="100%" height="225" styleName="TOCStyle" &amp;gt;&lt;BR /&gt; &amp;lt;mx:Label text="Live Layers" styleName="SectionTitle" /&amp;gt;&lt;BR /&gt; &amp;lt;mx:ToggleButtonBar dataProvider="{mapViewStack}" /&amp;gt;&lt;BR /&gt; &amp;lt;mx:ViewStack id="mapViewStack" width="100%" height="100%" paddingTop="5" paddingRight="5" paddingBottom="5" paddingLeft="5"&amp;gt;&lt;BR /&gt; &amp;lt;mx:Canvas id="canvasTOC" label="TOC"&amp;gt;&lt;BR /&gt; &amp;lt;toccomp:TOC id="mapTOC" width="100%" height="100%" useLayerFadeEffect="true" /&amp;gt;&lt;BR /&gt; &amp;lt;/mx:Canvas&amp;gt;&lt;BR /&gt; &amp;lt;/mx:ViewStack&amp;gt;&lt;BR /&gt; &amp;lt;/mx:VBox&amp;gt;&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&amp;lt;/mx:HBox&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Leon,&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; 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.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jun 2010 17:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248498#M5902</guid>
      <dc:creator>LeonScott</dc:creator>
      <dc:date>2010-06-28T17:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248499#M5903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to do the same thing with the VIPER code, which I believe is built off of the Sample Flex Viewer. I copied Robert's code snippet into the MapManager.mxml at the end of the Init funciton, but it didn't seem to do anything either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I guess I'm not even sure if I am starting in the right place. The path I used for that file in Flash Builder is src/com/esri/solutions.flexviewer/MapManager.mxml. Is that the right one? When I click on Run Index it opens up the application in bin-debug\index.html, but I don't even see any files with today's date in that folder when I view it in Windows Explorer. Is something not getting updated correctly when I compile my application?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 22:35:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248499#M5903</guid>
      <dc:creator>MatthewLawton</dc:creator>
      <dc:date>2010-08-02T22:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: TOC Control - expand at startup</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248500#M5904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matthew,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; Here is what you need in the LiveMapsWidget.mxml in the src/com/esri/solutions/esa/widgets/LiveMapsWidget.mxml if you are using the SFV 1.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//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
&amp;nbsp;&amp;nbsp; { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (expanded)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.openItems = toc.dataProvider.source;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for each(var item:TocMapLayerItem in toc.openItems) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.isTopLevel())
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; toc.expandItem(item,true,true,true,null);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:21:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/toc-control-expand-at-startup/m-p/248500#M5904</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T12:21:59Z</dc:date>
    </item>
  </channel>
</rss>

