Hi all,
I am trying to programmatically add layer to my map and TOC via the TOC widget.
However I am getting an error : "Cannot read property 'on' of undefined" when running the script. Not too sure what that means.
Anyway, my map is here. The idea is to click on a button and automatically add a layer to both TOC and map using bootstrap popover. As showed below

Any help is welcome!
Alex