qgis / qwc2-demo-app

QWC2 demo application
Other
240 stars 149 forks source link

Expand specific group in layer when called by another application #538

Closed mhaelsig closed 3 months ago

mhaelsig commented 3 months ago

With the parameter 'collapseLayerGroupsBelowLevel" I can globally set the expansion of groups in the themes layer. When I call QWC2 from another application https://qwc-services.github.io/master/topics/Interfacing/ I would like to expand exactly one or two of n groups in the themes layer. I have not identified such a possibility, even by using the API. Is there a way?

Background: In a theme I have 5 - 7 groups. Each of them can expand to 3 - 5 levels below. I open the map with all groups collapsed (collapseLayerGroupsBelowLevel=1) . Calling the map by another application (e.g. a blog), I present details with one or two active layers in one or two groups in some deep level. To reach the active layers, the user has actively to expand the group by clicking the + sign several times.

manisandro commented 3 months ago

Via API using window.qwc2.changeLayerProperty you should be able to change the expanded state of a group. Aside from that approach, there is currently indeed no way to control the expanded state of groups via URL params. One idea might be to add a expandTo URL param or similar which will expand the layer tree to the specified layer.