Requirement: with a button create a row and bring it up into focus (e.g. as a modal)
Problem: to bring out a row into focus, you need its
RowID() so that you could construct its URL like:
RowID() at this point may still be blank because the row is not yet stored to the server. And it will always stay blank if the doc is used in Play mode.
Solution: instead of
RowID() use “true” 10-alphadigit unique row ID (UID) that is created on browser side as soon as the row itself is created.
One idiom to get this UID is by formula:
Split(thisRow + "", "/").Last()
thisRow + "" returns
grid-xxxxxxxxxx/i-xxxxxxxxxx table/row UID pair (which, I believe, is used internally to compare row references against each other), and we use
Split("/").Last() to only cut off the row UID part.
Now you can use this identifier right away in your URLs.
Heads up: instead of
r<RowID> parameter you’ll have to use
so that instead of
/r123 your link looks like
E.g. here’s a button that creates a “helper table” row if it doesn’t exist (I’m using a helper table as a form to submit cross-doc updates), and immediately opens it as a modal:
This is one of the pro-tips that let you build docs that feel a lot like apps. There’ll be many more like this one on codatricks.com
P.S. Updated one of my older demos. Play around with this embedplay: create rows and see how UIDs are added immediately and row IDs are not. Then click the “Pop me up” button and see that popups by UID work just fine