Imagine I have a dynamic opener that changes the number of rows. For example,
opg = True;
Dynamic@Grid[{
{Item[Row@{"Show slider ", Opener[Dynamic[opg]]},
Alignment -> Center], SpanFromLeft},
If[opg, {"Slider 1", Slider[1]}, Nothing]
}, Frame -> All, ItemSize -> {{10, 10}}]
As you can see, whenever I click on the opener, the grid changes size to some default automatic size. Is it possible to keep the grid size based on the maximum default size its items can have? That is, I want the following behaviour
Using ItemSize
I can get something pretty decent, but not quite what I'm asking
Dynamic@Grid[{
{Item[Row@{"Show slider ", Opener[Dynamic[opg]]},
Alignment -> Center], SpanFromLeft},
If[opg, {"Slider 1", Slider[1]}, Nothing]
}, Frame -> All, ItemSize -> {{15, 15}}]
However, I'd like to keep it automatic everywhere apart from the "Show slider" item, to avoid weird spacing in the other items. How would you do it?.
Two small notes:
Grid
is that there is no way (as far as I am aware) to have a "zero-height" row where you could hide the size-giving elements. So the only other option is to precompute (viaRasterize
) the width of the columns, or to hide the elements in the header (which might actually work). One question is of course: Does it need to beGrid
, or would something that looks similar also work? $\endgroup$Grid
stays the same width on my machine. $\endgroup$Grid
were you thinking of? I guess it could also work, as long as it's list-based. $\endgroup$