Updated May 5th, 2007
****
Now you can move layers without doing the postback. I used two tool bar commands to move the layers and refresh both the map and the TOC so there is no annoying full page refresh. Using the AJAX already built into the toolbar commands, moving layers is now a lot prettier and quicker. Modify and enjoy.
UPDATED: Feb 5, 2007
****
Someone asked for the client side javascript, so I threw that in the text file as well, along with dimensioning all my variables for use with servercontext, etc.
****
UPDATED: FEB 2, 2007
****
Now layers are moved to match the changes you make in the TOC (using a callback) in both the map object and TOC! ENJOY!
****
VERY simple code snippet that allows you to create two buttons, up or down one index within the TOC control of a web application. I created two button events that trigger a javascript event that does a callback and uses the MoveLayer() method:
-Move Layer Up (with toc,map refresh)
-Move Layer Down (with toc,map refresh)
Modify it and spice it up with some graphics. In my case, I use the checked property to identify the node that should be moved. Pic included and error handling.
Thanks and enjoy!
|