Group Abstract Group Abstract

Message Boards Message Boards

3
|
16.1K Views
|
10 Replies
|
13 Total Likes
View groups...
Share
Share this post:

TableView improvement suggestions

TableView does not allow the deletion of a cell. Am I misunderstanding the usefulness of this function? Should it only be used to visualize a matrix or is it also intended to edit, add and remove cells?

table123 = RandomChoice[{True, False}, {4, 4}];
TableView[Dynamic[table123], AllowedDimensions -> {6, 6}]

... TableView Output ...

Dynamic[table123]

Any changes to the table are immediately visible in the output of the Dynamic[table123] command. Further cell content is easily added and the rectangular matrix grows. However, deletions and subsequent shrinkage of the matrix do not work. One can note that the last character that one tries to delete in a filled cell cannot be removed.

10 Replies
POSTED BY: Ian Williams
POSTED BY: Rodrigo Murta
POSTED BY: Jason Abernathy
Posted 5 years ago
POSTED BY: Stefan Popien
Posted 5 years ago

The following works. Replace cells to be deleted with "x" and press "OK", which will display a new TableView with the cells deleted. Pressing "Cancel" closes the dialog and the final data can be read from "table".

res=True;
While[res,
  res=ChoiceDialog[TableView[Dynamic[table],AllowedDimensions->{5,5}]];
  If[res,
    (table[[Sequence@@#]]=Null)&/@Position[table,"x",{2},Heads->False];
    table=Replace[table,{{Null..}->{},{x__,Null..}:>{x}},{1}];
    While[table[[-1]]==={},table=table[[;;-2]]]
    ]]

Hope it will be of use! / Hoffe es ist von Nutzen!

POSTED BY: Stefan Popien
Posted 5 years ago

The following kinda works, but apparently the TableView does miss some updates to "a" and even worse, then reverts them. So still not that useful.

Manipulate[
 TableView[Dynamic [a]], {del, "1,1", InputField[#, String] &}, 
 Button["delete", 
  a[[Sequence @@ ToExpression@StringSplit[del, ","]]] = Null]]
Dynamic@a
POSTED BY: Stefan Popien

Thank you for the reply. I had hoped, I had made a mistake. In its current state, TableView[] is completely useless.

Posted 5 years ago

I was quite disappointed by this behavior as well. When I read about TableView[] I immediately updated to 12.1, hoping to be able to build an easy to sue interface for data import.

But with TableView[] ignoring cell deletion this seems not feasible.

I wonder why the implementation was chosen to be like it is now.

POSTED BY: Stefan Popien

Funny things in TableView :)

TableView[Table[{n, N[ZetaZero[n], 5]}, {n, 1, 100}], ItemSize -> {15, 1}, AllowedDimensions -> {2, 100}]

Scroll Down to the end and See RED boxes. Scroll Up at the beginning and see No data in the Column 2.

Regards :)

POSTED BY: Mariusz Iwaniuk
Posted 5 years ago

Thanks for the pointer, I've reported this to the appropriate development team.

POSTED BY: Kyle Martin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard