]> saetta.ns0.it Git - zakgrid_go/commitdiff
Added column property hidden.
authorAndrea Zagli <azagli@libero.it>
Wed, 22 Jun 2022 13:48:37 +0000 (15:48 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 22 Jun 2022 13:48:37 +0000 (15:48 +0200)
grid/grid.go

index a32b99f36b87a6c4bf5e215867c571a3da2d5c1f..f01a7c97cc56dcfe91b763a9da63f957d989fa73 100644 (file)
@@ -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