Removing row from GridLayout

hi,
I’m trying to create an interactive plot using GLMakie, one of the thing I’m doing is adding menus from which the user can choose the data to plot.
Here is a simplified code which create the menus GridLayout:

using GLMakie

fig = Figure()
menugrid = GridLayout(tellwidth = false, tellhight= false)
x_menu_l = Label(fig.scene, "X : ")
x_table_m = Menu(fig.scene)
x_var_m = Menu(fig.scene)
menugrid[1,1:3] = [x_menu_l, x_table_m, x_var_m]

y_menu_l = [Label(fig.scene, "Y : ") for _ in 1:4]
y_table_m = [Menu(fig.scene) for _ in 1:4]
y_var_m = [Menu(fig.scene) for _ in 1:4]
y_rm_m =  [Button(fig.scene, label = "Rem") for _ in 1:4]
 
# adding 4 more rows to the grid
for (a,b,c,d) in zip(y_menu_l, y_table_m, y_var_m, y_rm_m)
    menugrid[end+1,1:4] = [a, b, c, d]
end

My question is, how can I remove the i’th row from the menugrid and update the GUI?
thanks in ahead

In principle like this

for c in contents(menugrid[end, :])
    delete!(c)
end
trim!(menugrid)

But currently the removed objects will still stick around in the figure, just detached from the layout. We need to fix that.

thank you for the quick answer.
So as I understand it at this point I can’t fully remove it.
I’ll try to think of a walk around solution.

Interestingly, if I redisplay the figure after removal, the objects are gone. So they are removed at some layer, just not from the live figure.

That’s true, is there any update \ refresh command to the figure with out closing and redisplaying it?

This should work for clearing plots:

for c in contents(menugrid[end, :])
    # clean up plots and some observables
    empty!(c.blockscene)

    delete!(c)
end
trim!(menugrid)

I’m not sure how complete the observable cleanup is with this. I wouldn’t be surprised if this leaves behind some ghost interactions, like an invisible button you can still press. If that is the case it would be good to open an issue for this.