Hi all,
I am trying to understand why the "insert new layer" of the TOC widget does not work with my script. It seems like I hooked the buttons correctly using on(domByID) technic. Not quite sure why the "Insert New Layer of the TOC widget does not work in my script.
Here is my map.
TOC widget is here
Solved! Go to Solution.
Hi Alex,
Managed to hook up the events, refer attached (delete.html).
Below is what i have done.
That is quite amazing! It does trigger the "hook click" alert! Should I modify my insert new layer script so that it triggers the "add layer"?
Thanks,
Alex
PS: I am very impressed, thank you again!
Hi Alex,
Glad it helped!
Didn't quite get your question here.
Sorry,
In your sample (that works perfectly) I do get the "Hook click" alert in window, but it still does not trigger the function that allows me to insert a new layer. I cannot figure out why. It must be easy but I don't see what I am missing.
I also get a "Uncaught TypeError: undefined is not a function"
My new map is here.
Thank you for your help and also the great work!
Alex
The order of your dependencies inside the require is wrong. You assign "dojo/query" to "Color" and "dojo/_base/Color" to query. They must match 1 to 1. This is talked about in the introductory documentation.
Hi Alex,
As mentioned by jonathan, the error is coming out because of the wrong module name definition.
You map.addLayer is not scoped within the click event. Move this line
map.addLayer(dynaLayer2);
to before
var h = map.on('layer-add-result', function(evt){
Thank you for your help! I will reshape my code.
Alex