openforis/sepal_ui

get_children returns empty if nested parent does not have the same "lookup" parameter

Closed this issue · 1 comments

https://github.com/12rambau/sepal_ui/blob/932154f99192d4b003943c0a581a7fd8e0c9f255/sepal_ui/sepalwidgets/sepalwidget.py#L181

Assuming we have a nested element called desc_a that we are aiming to retrieve:

list_ = sw.ListItem(
        children=[
            v.ListItemContent(
                children=[
                    v.Card(
                        children=[
                            v.CardTitle(
                                children=[
                                    "cm.calculation[indicator].title",
                                    v.Spacer(),
                                ]
                            ),
                            sw.CardText(
                                # attributes={"id": f"desc_a"},
                                children=[
                                    v.Html(
                                        tag="span",
                                        attributes={"id": f"desc_a"},
                                        children=[
                                            "cm.calculation[indicator].desc_active"
                                        ],
                                    ),
                                    v.Spacer(),
                                    v.Html(
                                        tag="span",
                                        attributes={"id": f"span_b"},
                                    ),
                                ]
                            ),
                        ]
                    )
                ]
            ),
        ]
    )

list_.get_children(id_="desc_a") will be empty..

list_.get_children(id_="desc_a")

that's unrelated. If you add the lookup to CardText the get_children method will only return one single element. The issues lies in the fact that v.Html are surprisingly NOT v.VuetifyWidget. I will make a quick patch