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