Using Table Selection to Populate Other View

Hi,

I'm trying to use Table in an app sort of similar to the garden example but imagine if there was a third view in the NavigationView for a third column.

And then imagine that if you selected a single plant in the middle table, a sort of detail inspector would appear in the third position with the data from your selection, updating as the selection in the middle table changed.

I'm struggling a bit to get this working. I've tried:

  • Wrapping the table column content closure's contents in a NavigationLink. This sort of works but it styles things oddly in the table column and as I scroll around, it seems to trigger on it's own, I'm guessing as cells are re-used or something behind the scenes. This feels wrong.

  • Moving row creation into the rows: parameter with TableRow but the only modifier there is for drag and drop, there's no onTapGesture or similar.

  • Watching for changes to the selected item via the binding and then acting on it then - this fires when I select stuff and I can get the related model object but I can't put a NavigationLink in there as it's outside of the view hierarchy so I'm not sure how to act on it.

I'm guessing there's some other way to handle this that I'm simply not thinking of but if anyone has any pointers, much appreciated!

Hmmm. Should I be using the Focus System for this?

Since I wrote the above post, I've been trying to get it to work with the focus system and it feels like I'm so close, just can't quite get it there.

If anyone has any tips, they would be much appreciated.

Nice to have double click, I wondering about the same. API looks a beta, but "Tables" looks v.nice.

It may be easier to present the detail in a sheet... rather than the three column layout you are currently working with? Are you using the row selection option for Table? From the documentation... **Supporting Selection in Tables** To make rows of a table selectable, provide a binding to a selection variable. Also sounds like it may be worth submitting a Feedback to Apple to describe the problems you are facing.

It may be easier to present the detail in a sheet... rather than the three column layout you are currently working with? Are you using the row selection option for Table? From the documentation... Supporting Selection in Tables - To make rows of a table selectable, provide a binding to a selection variable. Also sounds like it may be worth submitting a Feedback to Apple to describe the problems you are facing.

Yeah, I actually opened a DTS case for this and while it hasn't been updated in awhile, I basically got the vibe that there wasn't totally complete API support for what I wanted to do.

Using Table Selection to Populate Other View
 
 
Q