Comments (3)
I was able to reproduce the bug with this:
package main
import (
"os"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
)
func main() {
t := table.NewWriter()
t.SetOutputMirror(os.Stdout)
rowConfigAutoMerge := table.RowConfig{AutoMerge: true}
tableHeader := table.Row{"Col #1", "Col #2", "Col #3", "Col #4", "Col #5"}
t.AppendHeader(tableHeader)
t.AppendRow(table.Row{"Product", "Standalone", "foo bar", "1.1.1.1", ""}, rowConfigAutoMerge)
t.AppendRow(table.Row{"Test", "Standalone", "bar baz", "2.2.2.2", ""}, rowConfigAutoMerge)
t.AppendRow(table.Row{"Product", "RedisCluster", "foo baz", "", "Cluster #1"}, rowConfigAutoMerge)
t.AppendRow(table.Row{"Product", "RedisCluster", "bar baz", "", "Cluster #2"}, rowConfigAutoMerge)
var columnConfigs []table.ColumnConfig
for i, _ := range tableHeader {
columnConfigs = append(columnConfigs, table.ColumnConfig{
Number: i + 1,
AutoMerge: true,
VAlign: text.VAlignMiddle,
Align: text.AlignCenter,
AlignHeader: text.AlignCenter,
})
}
t.SetAutoIndex(true)
t.SetColumnConfigs(columnConfigs)
t.SetStyle(table.StyleLight)
t.Style().Options.SeparateRows = true
t.Render()
}
Output:
┌───┬─────────┬──────────────┬─────────┬─────────┬────────────┐
│ │ COL #1 │ COL #2 │ COL #3 │ COL #4 │ COL #5 │
├───┼─────────┼──────────────┼─────────┼─────────┼────────────┤
│ 1 │ Product │ Standalone │ foo bar │ 1.1.1.1 │ │
├───┼─────────┤ ├─────────┼─────────┤ │
│ 2 │ Test │ │ bar baz │ 2.2.2.2 │ │
├───┼─────────┼──────────────┼─────────┤ ├────────────┤
│ 3 │ Product │ RedisCluster │ foo baz │ │ Cluster #1 │
├───┤ │ ├─────────┤ ├────────────┤
│ 4 │ │ │ bar baz │ │ Cluster #2 │
└───┴─────────┴──────────────┴─────────┴─────────┴────────────┘
Will work on a solution for this soon.
from go-pretty.
@naughtyGitCat try https://github.com/jedib0t/go-pretty/releases/tag/v6.4.9 - this should fix your issue.
from go-pretty.
thanks, it fixed
from go-pretty.
Related Issues (20)
- Table - Allow `RenderCsv` to be formatted with tabs instead of comma HOT 5
- Markdown table row with multiline string adds <br/> HOT 2
- Why carriage return character '\r' is dropped when rendering? HOT 6
- The upgrade from v6.4.0 to v6.4.1 results in empty table content when used in our product. HOT 10
- Github lacks enthusiasm reports, which would be necessary with your go-pretty!!! Absolutely fantastic!!! HOT 1
- Auto merge sample in the docs does not separate header rows as shown HOT 1
- Calling SetRowPainter() will not compile HOT 3
- Automerge does not work in HTML rendered by table HOT 4
- Automatic right alignment of number-cells only when number in each row HOT 5
- Last column's header ignores ColumnConfig.AlignHeader HOT 1
- Cell alignment based on content like in Excel HOT 11
- Table.SortBy can't handle empty cells HOT 1
- regexp no longer required HOT 1
- How to print table in the middle terminal HOT 1
- Paging result not expected HOT 2
- Merging not all possible cells in a row HOT 2
- Paging is set when row/column cell merge is set at the same time, missing some cell data HOT 2
- Nested Table Structure HOT 4
- Allow removal of trackers and clearing of progress HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-pretty.