I have a LayerList with 3 ListItems. I want to order the ListItems differently than how they are added to the view.
Ex.
(my maps need to be added in this specific order so that layers can be toggled in the LayerList)
I want to order my ListItems in the LayerList in this order
Item 0
Item 1
Item 2
but the result of the ListItems are reversed
Item 2
Item 1
Item 0
Solved! Go to Solution.
Gregory,
There is no event for when the LayerList widget is done/ready so you have to rely on a timeout.
setTimeout(function(){
layerList.operationalItems.reverse();
}, 2000);
Gregory,
It is as simple as:
layerList.operationalItems.reverse();
Thanks. I am guessing that this line needs to be hit after any work on layer list items. And since I am iterating the layer list to hide items in listItemCreatedFunction, I'm not sure where to place it. Here's a codepen of my dev.
Gregory,
There is no event for when the LayerList widget is done/ready so you have to rely on a timeout.
setTimeout(function(){
layerList.operationalItems.reverse();
}, 2000);
That works. Thanks.