I would like to dynamically update individual parts of the Grid
in different ways. Consider the following toy example: I have two lines: you need to update one after another (a, b, c), since these characters depend on different triggers; the second line depends on one trigger (show), which allows you to display / hide some data.
Now I know that I can wrap the entire Grid
structure in Dynamic
and even indicate which characters to track, so this example does what I want:
Checkbox[Dynamic[show]] test = {0, 0}; Dynamic[Grid[{{ Dynamic@a , Dynamic@b , Dynamic@c }, If[show, Prepend[test, "test:"], {}]}, Frame -> All], TrackedSymbols :> {show}]
Although for certain reasons, I would like to have a locally specified Dynamic
that applies only to the second row of the Grid
.
For those who are wondering if this is an illogical situation, just imagine the following: show
used in any of a
, b
or c
, and this I DO NOT want to update when show
changes, their changes depend on other triggers. Why not remove show
from the characters of the first line? Imagine, I can’t, because show
present in a function that is used in a
, b
or c
, and this function cannot be easily accessed.
Of course, moving the first If
argument to Dynamic
will not help here, because the Grid
itself or any of its cells will not become dynamic:
Grid[{ { Dynamic@a , Dynamic@b , Dynamic@c }, If[ Dynamic@show , Prepend[test, "test:"], {}] }, Frame -> All]
In addition, wrapping a string in Dynamic
makes the specified string invalid because it no longer has a head List
:
Grid[{ { Dynamic@a , Dynamic@b , Dynamic@c }, Dynamic@If [show, Prepend[test, "test:"], {}] }, Frame -> All]
Dynamic
by line does not work either because show
not updating dynamically:
Grid[{ { Dynamic@a , Dynamic@b , Dynamic@c }, Dynamic /@ If[show, Prepend[test, "test:"], {}] }, Frame -> All]
Also, wrapping Dynamic[If[...]]
around list members works, but now I have to evaluate If
3 times instead of 1.
Grid[{ { Dynamic@a , Dynamic@b , Dynamic@c }, Dynamic[If[show,
I would like to know if there is any solution to overcome this specific problem by applying the Dynamic
shell locally in a string.