Update table example
This commit is contained in:
parent
d921faeffe
commit
24acd523c7
@ -12,43 +12,43 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer termui.Close()
|
defer termui.Close()
|
||||||
rows_1 := [][]string{
|
rows1 := [][]string{
|
||||||
[]string{"header1", "header2", "header3"},
|
[]string{"header1", "header2", "header3"},
|
||||||
[]string{"孙嘉你好吗", "Go-lang is so cool", "Im working on Ruby"},
|
[]string{"你好吗", "Go-lang is so cool", "Im working on Ruby"},
|
||||||
[]string{"2016", "10", "11"},
|
[]string{"2016", "10", "11"},
|
||||||
}
|
}
|
||||||
|
|
||||||
table_1 := termui.NewTable()
|
table1 := termui.NewTable()
|
||||||
table_1.Rows = rows_1
|
table1.Rows = rows1
|
||||||
table_1.FgColor = termui.ColorWhite
|
table1.FgColor = termui.ColorWhite
|
||||||
table_1.BgColor = termui.ColorDefault
|
table1.BgColor = termui.ColorDefault
|
||||||
table_1.Y = 0
|
table1.Y = 0
|
||||||
table_1.X = 0
|
table1.X = 0
|
||||||
table_1.Width = 62
|
table1.Width = 62
|
||||||
table_1.Height = 7
|
table1.Height = 7
|
||||||
|
|
||||||
termui.Render(table_1)
|
termui.Render(table1)
|
||||||
|
|
||||||
rows := [][]string{
|
rows2 := [][]string{
|
||||||
[]string{"header1", "header2", "header3"},
|
[]string{"header1", "header2", "header3"},
|
||||||
[]string{"Foundations", "Go-lang is so cool", "Im working on Ruby"},
|
[]string{"Foundations", "Go-lang is so cool", "Im working on Ruby"},
|
||||||
[]string{"2016", "11", "11"},
|
[]string{"2016", "11", "11"},
|
||||||
}
|
}
|
||||||
|
|
||||||
table := termui.NewTable()
|
table2 := termui.NewTable()
|
||||||
table.Rows = rows
|
table2.Rows = rows2
|
||||||
table.FgColor = termui.ColorWhite
|
table2.FgColor = termui.ColorWhite
|
||||||
table.BgColor = termui.ColorDefault
|
table2.BgColor = termui.ColorDefault
|
||||||
table.TextAlign = termui.AlignCenter
|
table2.TextAlign = termui.AlignCenter
|
||||||
table.Separator = false
|
table2.Separator = false
|
||||||
table.Analysis()
|
table2.Analysis()
|
||||||
table.SetSize()
|
table2.SetSize()
|
||||||
table.BgColors[2] = termui.ColorRed
|
table2.BgColors[2] = termui.ColorRed
|
||||||
table.Y = 20
|
table2.Y = 10
|
||||||
table.X = 0
|
table2.X = 0
|
||||||
table.Border = true
|
table2.Border = true
|
||||||
|
|
||||||
termui.Render(table)
|
termui.Render(table2)
|
||||||
termui.Handle("/sys/kbd/q", func(termui.Event) {
|
termui.Handle("/sys/kbd/q", func(termui.Event) {
|
||||||
termui.StopLoop()
|
termui.StopLoop()
|
||||||
})
|
})
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 46 KiB |
Loading…
Reference in New Issue
Block a user