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.

11 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:

3 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

@Hannah (or whoever), is there any chance this has been worked out in an easier way? These instructions are making my brain hurt and I’m really hoping there’s a simpler fix for it…

1 Like

HI @Kelly_Claus! This is not yet supported natively but it’s definitely on our radar. In the meantime, @Paul_Danyliuk’s workaround above is both a bit easier to set up and more elegant all around, it’s now my preferred solution for this. Specifically this post he linked is an excellent explainer: PSA: Link to recently created rows by UID, not RowID()

3 Likes

It’s very simple:

AddRow([Base Table]).OpenRow([View of Base Table], "Modal")
6 Likes

Thank you so much for this. I have spent more time than I care to admit trying to solve this.

1 Like

This would be a great native feature, just had a pretty frustrating couple hours

OMG @crocus THANK YOU