Assign "add row" buttons a view-specific modal

I’ve seen a handful of folks asking about adding a new row via a button, but using a specific view and not the base table to do so.

Currently, the “open row for editing” option in buttons will always open the base table view. (I.e. even if the button is configured to add to a specific view, the modal that opens to enter your details will use the base table’s default, including layouts and hidden columns.)

We’re hoping to make some internal improvements that allow for different layouts or view settings here, but in the meantime, here’s a workaround (instructions in doc):

Hope you find this useful! Curious to see if others have found novel ways around this problem.

6 Likes

Thanks for posting this. I recently needed to do this and had to piece together info from several different posts across the forums (and it took quite a lot of time). I think this post will be very helpful to others.

In the end, I settled on a slightly different approach. There are ideas from the OP above that I like, and some I like from this one (such as using Url() to get the URL). Perhaps I’ll rework my own to integrate the “floating blank row” approach as opposed to the noop/delay approach to deal with race conditions.

RunActions(
  AddRow(
    [Base Table]
  ),
  _Noop()._Delay(0),
  OpenWindow(
    Url([View of Base Table])
    + "/r"
    + [View of Base Table].[Row ID].Last()
    + "/&modal=true"
  )
)
4 Likes

Hey @Hannah, there’s one thing with this demo that is not working (and I guess that’s what @Brandon2 is seeing too). The problem is that Row IDs is often not yet assigned to the row when you’re performing the action, so OpenWindow will not open that popup. Even in your demo, clicking the button adds a row but opens a different one (in embedplay mode Row IDs are not assigned at all).

I’m describing this behavior and offering an updated trick here:


P.S. Even simpler, instead of figuring out whether to use Row ID / UID (because sometimes you’d need one over the other), just get that from thisRow.Url().Split("/_r").Last()


P.P.S. Also my writeup on the same scenario:

2 Likes

Really need this . Thanks.

Hey Paul! Thanks for taking a look!

This demo intends to open a different row — basically using a floating placeholder row as the “new” row. I don’t think it’s as elegant as your solution, though.

2 Likes