Skip to content

Commit

Permalink
support tableview:+ to display a field in a table view but not a stru…
Browse files Browse the repository at this point in the history
…ct view for #668
  • Loading branch information
kkoreilly committed Feb 4, 2024
1 parent 4178011 commit 23d1a11
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions giv/tableview.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,18 @@ func (tv *TableView) CacheVisFields() {
return false
}
tvtag := fld.Tag.Get("tableview")
if tvtag != "" {
if tvtag == "-" {
return false
} else if tvtag == "-select" && tv.IsReadOnly() {
return false
} else if tvtag == "-edit" && !tv.IsReadOnly() {
return false
}
switch {
case tvtag == "+":
return true
case tvtag == "-":
return false
case tvtag == "-select" && tv.IsReadOnly():
return false
case tvtag == "-edit" && !tv.IsReadOnly():
return false
default:
return fld.Tag.Get("view") != "-"
}
vtag := fld.Tag.Get("view")
return vtag != "-"
}
laser.FlatFieldsTypeFuncIf(styp,
func(typ reflect.Type, fld reflect.StructField) bool {
Expand Down

0 comments on commit 23d1a11

Please sign in to comment.