I have 2 featureLayer, one with "parent" elements and the second one with their "children". I'm trying that when i clic on a "parent" element the "children" in the other layer get shown.
I can´t use layer.setVisible(false), because then when i use layer.setFeatureVisible(feature, true) or layer.setFeaturesVisible(features, true) it does not work.
I have not found a way to set all the features in a layer hidden from the beginning.
I try to ask for all the features with a queryFeature an set all visible false but i have more than 50.000 features and layer.setFeatureVisible(feature, true) takse a lot of time to do it and layer.setFeaturesVisible(features, true) collapse the app. And the reality its that i have not 2 but many layers. that i have to do the "parent childre" activated.
If anyone have an a idea on how to do it. Thanks!
Hi Maria, thanks for your question. It might help us to understand the higher level use case you are trying to achieve; maybe there is a different way to achieve the same result. For example, do the children have to be point features, could they be polygons which represent the area of the children? Or, after the parent is selected can you zoom to the area of the children, so that most other children are out of view and there are less to make invisible?
If you really have to use the solutions you have tried, then perhaps you can initiallly set layer.setVisible(false) and in the background, start to turn all the children invisible. You said this takes a long time, remember to prioritise those children that are actually in the view. Perhaps full invisibility can then be achieved before the user selects a parent. Then when a parent is selected, the layer and some children can be made visible.
It likely that with a combination of approaches you can find a solution.