# Incrementally revealing Grid (or TableForm) entries

I have a Grid (or TableForm) object like this

Grid[{{Ins, Outs}, {a, b}, {c, d}, {e, f}}, Frame -> All]

that I would like to "incrementally reveal" (within a Manipulate) in the sense, for example, that one row at a time is revealed with each click of the Manipulate.

The part giving me trouble is that I want to "fill in" the table from bottom to top, while maintaining the (final) header cells and grid lines throughout each incremental reveal.

I started out by filling the yet-to-revealed entries with white space (until they are revealed). This is fine for small tables like this, but I also need it to work for tables with dozens of rows so I am seeking something more systematic.

Any hints/tips/nudges would be appreciated.

Edit: To clarify, the desired behavior is like this:

one = Grid[{{Ins, Outs}, {, }, {, }, {e, f}}, Frame -> All];
two = Grid[{{Ins, Outs}, {, }, {c, d}, {e, f}}, Frame -> All];
three = Grid[{{Ins, Outs}, {a, b}, {c, d}, {e, f}},
Frame -> All];
Manipulate[{one, two, three}[[i]], {i, {1, 2, 3}}]


• Maybe you just need double InputField with dynamic referrence to rows? I think wider contex is required. – Kuba Jul 19 '13 at 21:30
• @Kuba: The entries I'm wanting to reveal to the viewer are not input that the viewer provides (and that seems to be what InputField is for). Instead, the entries are values which have been computed "offline". – JohnD Jul 19 '13 at 21:33
• I see, something like this: grid = {{Ins, Outs}, {a, b}, {c, d}, {e, f}}; Manipulate[ Grid[{First@grid, grid[[n]]}, Frame -> All] , {n, 2, Length@grid, 1}] ? – Kuba Jul 19 '13 at 21:39
• Or this grid[[;; n]] instead of {First@grid, grid[[n]]}. – Kuba Jul 19 '13 at 21:42
• @Kuba post it :-) – Mr.Wizard Jul 19 '13 at 21:45

My version:

data = {{Ins, Outs}, {a, b}, {c, d}, {e, f}};

Manipulate[
m = data; m[[2 ;; n]] = {}; Grid[m, Frame -> All],
{n, Length@data - 1, 1, -1},
{m, None}
]


• Is {m, None} only for scoping purposes? (+1) – Kuba Jul 19 '13 at 22:51
• @Kuba Correct. I'll try to find the reference for that and update this comment when I do. That was quick; here it is. I think that answer makes a good case for this being a reasonable practice. – Mr.Wizard Jul 19 '13 at 23:25

Edit. Clear version with ConstantArray but I like more the latter with ArrayPad.

Manipulate[
Grid[
Flatten[{
{grid[[1]]},
ConstantArray["", {n - 2, 2}],
grid[[n ;;]]
}, 1]
, Frame -> All]
, {n, 2, Length@grid, 1}]


ArrayPad seems to fit this job best :)

grid = {{Ins, Outs}}~Join~Partition[CharacterRange["a", "z"], 2];

Manipulate[
{{n - 1, 0}, 0}, ""],
Frame -> All],
{n, 1, Length@grid - 1, 1}]


And the SetterBar version analogical as OP's.

Manipulate[

• Ok, with that edit and then {n, Length@grid - 1, 1, 1}, it does what I as looking for. Thanks. I will leave it open for a little while to encourage other answers. – JohnD Jul 19 '13 at 22:00