From: Andrea Zagli Date: Wed, 22 Jun 2022 13:48:37 +0000 (+0200) Subject: Added column property hidden. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=cb2618e7dc1a305a47f130a77723cd51c7fd8dbf;p=zakgrid_go Added column property hidden. --- diff --git a/grid/grid.go b/grid/grid.go index a32b99f..f01a7c9 100644 --- a/grid/grid.go +++ b/grid/grid.go @@ -12,6 +12,7 @@ type Column struct { Name string Title string Align int + Hidden bool ToCall MissingCol } @@ -67,12 +68,14 @@ func (g *Grid) GetHeader () string { header := "" - for i, v := range g.cols { - var b bytes.Buffer - err = tr.Execute(&b, v) + for _, v := range g.cols { + if !v.Hidden { + var b bytes.Buffer + err = tr.Execute(&b, v) - header += b.String() - fmt.Println(i, v) + header += b.String() + //fmt.Println(i, v) + } } var b bytes.Buffer @@ -123,13 +126,15 @@ func (g *Grid) GetRowFromMap (m map[string]interface{}) string { } } - nnc := nc{Column: c, Value: v} - fmt.Println(nnc) + if !c.Hidden { + nnc := nc{Column: c, Value: v} + //fmt.Println(nnc) - var b bytes.Buffer - err = tc.Execute(&b, nnc) + var b bytes.Buffer + err = tc.Execute(&b, nnc) - ret += b.String() + ret += b.String() + } } var b bytes.Buffer