Are there any relevant code examples to show how to use
TableColumnBuilder and TableRowBuilder ?Thank you.
Post
Replies
Boosts
Views
Activity
Using NSTableView in Cocoa framework, it is easy to implement drag and drop sorting of table headers (not row sorting). But I didn't find out how to use the Table component in SwiftUI.
I want to use the Table component to achieve the following functions
Right click the column header to pop up context menu
Right click each row to pop up context menu
I found that TableColumn and TableRow objects are not of type view. Setting contextMenu is not supported.
I can set the ContextMenu on the cell in the following ways, but it only works inside the cell, and clicking on the blank part does not take effect.
TableColumn("Given Name", value: \.givenName) { person in
Text(person.givenName)
.contextMenu(menuItems: {
Button {
} label: {
Text("New Order")
}
})
}
How to set independent context menus on rows and column headers?