From: Andrea Zagli Date: Sun, 22 Aug 2021 07:02:25 +0000 (+0200) Subject: Taking into account column property align. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=87da0bfba11e46a39f88bb620443eab263e16614;p=zakgrid_go Taking into account column property align. --- diff --git a/main.go b/main.go index 7de1eef..40096a9 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,15 @@ func (g *grid) getRowFromDb (m map[string]interface{}) string { v = c.toCall(m) } } - ret += fmt.Sprintf("\t%v\n", v) + + align := "" + if c.align == 1 { + align = " align='center'" + } else if c.align == 2 { + align = " align='right'" + } + + ret += fmt.Sprintf("\t%v\n", align, v) } ret += "\n" @@ -78,6 +86,7 @@ func main() { c = column{name: "btn", title: "Buttons"} c.toCall = missing + c.align = 2 g.addColumn(c) fmt.Println (g)