Have the following code and nothing happens when the LayerList updates.
var layerList = new LayerList({
view: view,
container: "layers",
createActionsFunction: defineActions
});
var listChanged = layerList.watch('operationalItems.length', function (length) {
console.log("New item added or item removed. Length " + length);
fixPopupsInList(layerList.operationalItems);
});
I wan to change the color of the titles to indicate the popup is enabled (works fine) when a new layer is added, but the refresh of list removes the color indicator, so was thinking of reapplying color when popupEnabled == true on each add, but the above watch doesn't work for some reason. Any ideas? Thanks in advance.
I realize there are several workarounds, but want to understand why watch(obj, callback) isn't working and use it if can.
Solved! Go to Solution.
Worked for me in this example where I remove a layer from the list
Worked for me in this example where I remove a layer from the list