"Nested" detail pages

Hello all,

This one may be tricky to explain, but here goes.

So I have a collection of events
Click on the collection and I get a detail page for that event
On that detail page, I have another collection with a relation to the crew assigned to that event
Clicking on a collection item and opening another detail page - opens the row in the crew table

At that point I have no easy reference back to the rowID for the original event.

I’ve been setting the row ID of the event to the users table - but wondered if there was a better way as I suddenly think I may be missing something.

Andrew

1 Like

Hey Andrew, I think this might work for you case.. Use a custom action with set columns before navigating, it goes like this: when a user clicks on the crew member in the collection:

  • Use a custom action that first sets a temporary column (like a user-specific column called Selected Event ID) either on the Users table or in a helper table.
  • Then navigate to the crew member’s detail screen.
  • Now, in that screen, you still have access to the original event ID through that column.

This avoidss permanently writing data and keeps context tied to just the current user session.

1 Like

You can also consider using a screen that’s based on a helper relation or a joined row that includes both the event and the crew info, depending on how your data is structured. That way, both Row IDs can be referenced from one screen.

1 Like

Thanks loads Mazen

That’s pretty much how I do it now - though I have also pulled the rowIdD from the deep link URL with Javascript.

Sounds like I am not missing a trick!

Thanks,
Andrew

1 Like

Just expanded this slightly - I use this Javascript column

let url = p1;
let index = Number(p2) - 1; // Convert to 0-based index

// Find all /r/{rowId} matches
let matches = […url.matchAll(//r/([^/]+)/g)];

// Return the requested row ID or null if not found
return matches[index] ? matches[index][1] : null;

In p2 I pop the nesting level (in my case 2) - that returns the second rowID in the deep link (which is p1)

Saves having to have temporary set column actions etc and a couple of columns.

Thoughts anyone?

1 Like

Please be careful with this. I have run into scenarios before that the script doesn’t re-run when I navigate through the app. I would either have a “current time” input to force it to run almost constantly (it isn’t 100% fool proof though), or find a way to do it differently (i.e the set column method Mazen suggested).

With the set column method, you must also consider that it is valuable when you access the crew’s screen in that same tab. What if you have another tab where you just put crews on the top level? If you show anything related to the “Event”, it can be confusing, maybe have a conditional visibility that the “Event”-related stuff can only be shown in the Events tab (based on screen URL).

2 Likes

Thanks for this both

A part of me did wonder whether the deep link was reliable. Seems to be working so far and saves a few columns / actions so will see how it goes and keep an eye on it. Suspect I may end up going back to Mazen’s suggestion as really want it to be rock solid.

Thanks again
Andrew

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.