Menu for editing the same record in multiple pages

Based on the excellent post by Dmitry Sagalovskiy on the usage of anchor links and SELF_HYPERLINK’s, I expanded his solution to develop a simple menu navigation. It solves both, editing large tables with 120+ culumns, and ensures that the same record remains active when switching between pages in Grist.

You can download an example on my Github repository grist menu for large flat tables.

To test, open one of the menu pages, and select a “main topic” in the table to the left (Ubuntu, Debian, or Fedora). Click on the menu links in the “Menu bar” to open a new page with different information of the same topic.

In essence, I use 2 Cards of the same table, one for the menus, and one for the specific data to be displayed on the page. Not to forget Grist’s nice feature to duplicate Pages. I.e. you can prepare a master menu page for duplication.

This example makes use of the follwowing functionalities in Grist:

step-by-step

I do assume that you have rudimentary experience in using Grist’s tables, pages and fields navigation, respectively formatting. If, not please visit Grist Help Center and familiarize yourself with the key functionalities of Grist and/or watch the video tutorials.

  1. in your large table: add a column for each menu page you want to create. Theses columns will hold the links to your menu pages, call them, for example, “Menu 1”, “Menu 2”, …
  2. create a New Page in Grist using your large table
  3. rename the Page to, again, for example, “Menu 1”
  4. hide all columns except the selector field, i.e. your “Main topic”
  5. add 2 card widgets and relate (Select by) the data to the main table.
  6. place the first card widget on the top of your page, show only the Menu 1, Menu 2, … fields, choose Block formatting and edit the layout to display the fields from left to right, i.e. “Menu 1”, “Menu 2”, …
  7. place the second card widget to the right of selector table and choose the fields you want to display on this page.
  8. Optional but recommended, rename widget titles to
    • Menu: “Menu selector”
    • Table 1: “Main topic”
    • specific data: “Menu 1 data”

Repeat steps 2. to 8. for as many “Menu” pages you require

To create the menu functionality:

  1. Let’s start with page “Menu 1”. Right-click on the field “Main topic” in the main table and choose “Copy anchor link”.

  2. Open a text editor, copy the link, and follow Dmitry Sagalovskiy’s example on the usage of anchor links and SELF_HYPERLINK’s. Turning the anchor link:

    https://<your server address>/Menu-bar-for-large-flat-tables/p/2#a1.s4.r1.c5

    into the formula:

    SELF_HYPERLINK(label="Menu 1", page=2) + "#a1.s4.r{}.c5".format($id)

  3. copy and paste the formula into the field “Menu 1” created earlier in your large table. Don’t forget to format the column as “Text” and change the cell format to "Hyperlink

Repeat steps 9. to 11. for all other Menu pages, and create SELF_HYPERLINK’s accordingly.

Result

Choose a “Main topic” in any menu and navigate to another Menu page: The record of the “Main topic” will remain selected.

Bonus for the lazy geek

In table Hyperlinks you can copy the Anchorlink in column “anchor” and it will generate above conversion automatically in column “SELF_HYPERLINK”. The string operations can be reviewed in the hidden columns.

3 Likes

Interesting.

I suppose it’s possible to do the same with the Action Button, right?
If there is a special screen for the menu, you can create several action buttons.
Alternatively, JPeron recently modified the action button so you can have several action buttons in the same widget.

Hi @Rogerio_Penna, thanks for the suggestion. I will check the multiple Action Button option. In general it should be possible, I suppose.

Hi @Rogerio_Penna, looks like it’s not possible yet, see here a reply from Dmitry: Button style for hyperlink field - #2 by Jen_NGT and grist-core DocActions.ts: grist-core/app/common/DocActions.ts at 5f0c3bd8545256b4d3310ace197aace284ce8633 · gristlabs/grist-core · GitHub No action yet to execute a SELF_HYPERLINK with an Action Button. Or do you know more?

Yes, I guess you would need two clicks of the button, since Action Buttons can´t be used as links (they can only change data, like update, create, delete records or tables)

In theory you could use actions buttons to update a link. But I guess your system is better already

1 Like