Select to view content in your preferred language

TOC & Map Layers

1193
10
03-01-2011 01:47 AM
FaizanTayyab
Deactivated User
I am using Robert's TOC for Flex View 1.3 which handles scale dependency. It works great however, sometimes (not always) on loading the site, one or two mapservices/map layers in the TOC do not have the (+ tree node expander) in front of them (to display the layers contained in that map service). In other words, i think, the mapservice doesnt load (for reasons i am still not sure about as it happens only sometimes on initial loading or even on refreshing the webbrowser), hence the code which is rendering the TOC items doesnt work. Is there any way to ensure that all layers have been loaded before being rendered (in the TOC) else wait for all layers to finish loading? It might also be the case that the layers are loaded on the map but the rendering is not working?

Any ideas on how to sort this out.
Tags (2)
0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus
Faizan,

  That code for 1.3 has been out there for a VERY long time and I have had no reports of this behavior. The first thing I would do is switch back to the standard TOC and test for some length of time to see if it exhibits the same behavior. It sounds more like you have some slow map services that are causing the issue.
0 Kudos
FaizanTayyab
Deactivated User
Thanks for the reply.

Actually, i took over the project from a previous developer who although created the TOC but was not able to sort out the scale dependency stuff. His scale dependecy code seemed to work sometimes but usually falls over with all checkbox greying out at all scales (on extent change or simple first loading or even on refresh) 

At that point i added your code and was able to make it work perfectly but this also introduced the problem i outlined earlier.

Although the previous developer's code, didnt work properly with scales, it never had the problem i am experiencing now. His code does show all layers (map services) in the TOC even the really big ones which take time to load, initially the slow loading layers (map service) wouldnt have the + sign in front of them but after some wait it does appear.

Now my issue is that the code i used, actually never seem to show the + sign in front of the slow loading map services. I even removed the slow loading map service and strangely it shows same behaviour for very simple map services as well (i.e, it doesnt show the + sign in front of the map service, but as i mentioned, this doesnt happen always).

I have tried the standard TOC code as you advised and it functions fine. I have also simplified some complex map services and now all layers are loaded and rendered fine.

I am assuming the moment i will add the scale dependecy code, it will cause problems as before.

I
0 Kudos
FaizanTayyab
Deactivated User
After installing the debugged version of flash player, i am getting:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
 at com.esri.solutions.flexviewer.widgets::LiveMapsWidget/updateTOCBoxes()
 at com.esri.solutions.flexviewer.widgets::LiveMapsWidget/getMasterDetailsResult()
 at mx.rpc::Responder/result()
 at com.esri.ags.tasks::LayerDetailsTask/handleDecodedObject()
 at Function/http://adobe.com/AS3/2006/builtin::call()
 at com.esri.ags.tasks::BaseTask/handleResult()
 at Function/<anonymous>()
 at mx.rpc::Responder/result()
 at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()
 at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()
 at HTTPOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
 at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
 at mx.rpc::Responder/result()
 at mx.rpc::AsyncRequest/acknowledge()
 at DirectHTTPMessageResponder/completeHandler()
 at flash.events::EventDispatcher/dispatchEventFunction()
 at flash.events::EventDispatcher/dispatchEvent()
 at flash.net::URLLoader/onComplete()


Although, with this error, the + sign still displays, it is only sometimes that the + sign (layer doesnt load).
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Faizan,

  I am sorry I just don't have time to support code that is not mine. I don't have a getMasterDetailsResult function in my code. I am just to busy supporting the current release of the FlexViewer and all my new widgets.
0 Kudos
FaizanTayyab
Deactivated User
Robert,

Thanks for the reply. I believe i took the code from a forum where you provided the answer related to TOC and Map Layers. If this code is not completely yours, can you please provide a link for your scale dependent TOC and also the live map layers widgets. I would then test to see if the same problem occurs or not.

Many Thanks
Faizan
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
FaizanTayyab
Deactivated User
Thanks for the link. i assume it is for 2.x only whereas i am working on 1.3.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Faizan,

   Yep I am only supporting 2.x widgets now.
0 Kudos
FaizanTayyab
Deactivated User
Thanks, but do you have link to your 1.3 code.
0 Kudos