Mega trick: Different "Expand row" layouts for the same row

Most likely you’re familiar with “Expand row” feature that lets you see a popup for a row by clicking here:

And perhaps you know the action Activate() to open that popup programmatically with a button, or at least used the “Add new row and open for editing” checkbox.

And also you may know that you can configure row details popup layout just like you can edit the layout in Detail view:

What you may not know though is that you can configure this popup’s layout individually per each view of your table.

Now, when you use thisRow.Activate(), the popup that will be brought up will always be the one of the master table. However, if instead of Activate() you use view-specific URLs like #_tuAPf/r{RowID}&modal=true, you can summon popups as configured for other views.

:point_down: Watch the video, and you’ll get it

With this trick you can have a compact table with a few buttons, each of them configured to open popups with only certain fields. E.g., if it’s a table of Classes, you can have one popup that deals with cancellation and rescheduling, another popup with program management (lesson doc links etc), another popup to review attendance and homeworks, and so on. Just make a few views that you can hide away, then configure popups differently for these, and then open the respective popups with buttons set to OpenWindow() different links.


UPDATE: Now there’s no need to hack around with URLs. There’s a new function OpenRow() that takes the view as an argument. The formula would be simply like:

thisRow.OpenRow([View 1])
35 Likes

Oh, turns out I’m not the first one to discover this :slight_smile:

Props to @Krunal_Sheth

2 Likes

Dear @Paul_Danyliuk,

Great that you highlighted this method again in a very detailed way.
Looks like only a few picked this up and somehow Coda doesn’t make much publicity on its potential, while in my eyes there is enough to explore as you already gave some clear direction.

Great job again :boom::boom::boom:

2 Likes

And one more thing: you can use UIDs and not RowIDs. This is especially useful if you want to open a recently created row that possibly hasn’t yet had a chance to have its RowID assigned, or a doc used in Play mode:

2 Likes

How could this work for a button that’s adding a row to a table? For instance, I have a table of candidates for jobs, and a table of interactions. From the table of candidates, I want two buttons, on that adds a row for a simple interaction, and another that adds a row to the same interactions table, but with interview fields exposed. I want the button to add a row, and expand the row details with different views depending on which button is clicked.

@Matthew_McAllister I think this is a great opportunity to test the frontier and check back! I’d make a few views of the table, edit/customize the default pop detail, then create buttons that addrows and activate those views. Let us know what worked!

It doesn’t fix it, unfortunately. I’ve noticed on other threads that when you add a new row, the view of that expanded row at the point of creation is based on the Layout of the original table, not views of it, even if the button is set to add a row to a View Table.

I’ve read about a bunch of workarounds that get quite involved, but this feels like a simple add row error with buttons and the tables they point to for Coda to address, so I’m currently waiting for that.

Broadly, it feels like Layouts in general is in need of a refresh. Being able to organize hidden fields so that the “Show Hidden Fields” becomes more of a “show more” in certain contexts, adding heading sections, and more options to visually break things up feels overdue.

3 Likes

Absolute agree that layouts needs more work.
It feels like they were a really nice idea to present a row in customisable way, then the customisation was abandoned.

Yes, the can be customised to a small degree but there are no colours or groupings to help make a really attractive UI.

3 Likes

Yet. Coda has been shipping a lot of features at a brisk pace :slight_smile:

2 Likes

I would use this also.

Perhaps the desired row display configuration could be made available as a parameter in the button UI?

6 Likes

And therein lies some of the potential issues.
There are still some quite fundamental problems with Coda (no text input box, performance with large tables, sharing of tables across disparate groups of people, difficult editing for reasonably complex formulae) that haven’t really been addressed. There are some clunky workarounds, but not true solutions.

We all have our own opinions, but I do feel there are some fundamentals that still need work ahead of the sexier stuff.

4 Likes

Waiting for a solution like that!
Is there any workaround?

thks

1 Like

Having the exact issue @Matthew_McAllister mentioned above - I have want to have two buttons on the same page that add a row to the same table, but with different layouts in the modal. @Paul_Danyliuk I’ve read a couple of your posts that talk about things related to this (specifically: Mega trick: Different "Expand row" layouts for the same row & PSA: Link to recently created rows by UID, not RowID()), but they’re a little over my head (only a month in with Coda, so a bit of a noob), and I’m not sure they address this particular issue anyways?

Any help would be greatly appreciated. This functionality is fairly necessary for what I’m building. :confused:

2 Likes

Yes, my trick will let you have two buttons that open the same row with different layouts. You’ll have to combine a few steps for this:

  • Add a row
  • Save the added row into some temporary cell, e.g.
    thisRow.ModifyRows(
      JustCreatedRow, MyTable.AddRow(...)
    )
    
  • In your MyTable make a formula column with row ID/UID like this:
    thisRow.Url().Split("/").Last()
    
  • Then open the popup for that created row by following the link constructed out of the view ID and that column with the last part of the URL
    OpenWindow(Format(
      "#_ViewID/{1}&modal=true",
      thisRow.JustCreatedRow.IDorUID
    ))
    

You need to make a dedicated column for the URL or the ID/UID (the last part of the URL) because simply calling thisRow.JustCreatedRow.Url() in the last formula won’t return the URL of the lookup value, but rather the URL of thisRow for some reason. Maybe it’s a bug, or maybe Codans had something else for it in mind (e.g. returning a Url() of a particular cell, just like Modified()-like functions return modification time of the lookup cell, not of the objects in that cell)


You can actually implement just one button and have some conditional logic in it to open either popup, e.g. if an admin user is clicking the button use one URL otherwise use another URL. You can put an If() inside Format()'s first parameter.

2 Likes

@Paul_Danyliuk So much I’m confused about here - apologies…

  1. I think you’re instructing me to include these buttons in the table itself (is that incorrect?). What I’m wanting is two buttons on a separate page altogether, both of which open a modal (with different views from one another) so that the user can add a row to that one single table (the one that exists on another page).

Use Case, if it matters:

  • I have a table in my CRM which houses organizations of different types (i.e., funders, schools).
  • The user needs to add different information for schools than for funders, so I’ve set up a different layout for each.
  • In my SOPs, I have a page for adding organizations (same doc, different page than where the table lives) which has two buttons: one for adding a funder, and one for adding a school.
  • The “Add a Funder” button should open up a modal with the layout I’ve made for that purpose, and the “Add a School” button should open up the other one.

  1. When you say “Save the added row into some temporary cell” despite my intensely-furrowed brow, I have zero idea what that means. :confused:

  2. When you reference “JustCreatedRow” is that supposed to be a formula parameter Coda recognizes? Or is that a placeholder for whatever’s in the Display column for the new row I’ve created? (In which case, I have a formula in my display column, so is what you’re suggesting even possible?)

  3. I get the ID/UID thing - that’s done

  4. When you say “Then open the popup…” are you saying this formula you’ve put here is the formula that goes in the Action field for the button?

1 Like

Hey @Kelly_Claus — I’ll get home and record a short video for you. Meanwhile here’s the “best practices” solution for you — this is what you should do for the “create new record” flow ideally.

Forgive the sound quality — the audio got janky midway the video and just at the interesting part

(at about 40 mins)

2 Likes

For many situations a simple solution might work: under table options you can make forms, the forms can be embedded on any page and you can make different forms for different purposes.

Once the form has been submitted, the data ends up in your table with a very small delay (sometimes you need a refresh to see the new rows).

You can use buttons to jump to the page with the form you need.

1 Like

WOOOOOOAAAAAHHHHH

:exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head: :exploding_head:

Alright, playing with this. Thank you kindly, sir. Absolute gold.

2 Likes

@Paul_Danyliuk I DID IT. You’re the greatest, thank you so much, I feel like a total beast now.

3 Likes

Awesome!

For completeness sake though I recorded the explanation for the above

7 Likes