When a listitem is clicked in layerlist widget, how to change its parent and sublayers' visible

200
3
10-01-2021 02:21 AM
BINJI
by
New Contributor

Hi,

did anyone build or find a solution for changing a listitem's parent and sublayers' visible when it is clicked in layerlist widget?

thank you.

0 Kudos
3 Replies
ReneRubalcava
Frequent Contributor II

I'm not quite sure what you're trying to do, but each ListItem has a reference to its parent and children you can interact with. This demo does that.

https://codepen.io/odoe/pen/ExXJKya?editors=1000

BINJI
by
New Contributor

Hi,Thanks for your reply.  When a listitem's visibile is changed to true, it has looped to walk through the parent  setting visible attribute to true,but as the same time, I want to set it's all children's visible attribute to true. How to do this?

0 Kudos
ReneRubalcava
Frequent Contributor II

In that sample you can just loop through the children and set their visibility too.

0 Kudos