Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set cell-level meta for the header #3

Closed
djm opened this issue Dec 29, 2015 · 0 comments
Closed

Add ability to set cell-level meta for the header #3

djm opened this issue Dec 29, 2015 · 0 comments

Comments

@djm
Copy link
Owner

djm commented Dec 29, 2015

This will allow cell-level alignment in the header cells, which is only currently possible by passing in already formed %Cell{} structs to Table.set_header/2.

Proposed API:

alias TableRex.Table
row = ["Konflict", "Cyanide", "Renegade Hardware", 1999]
header = ["Artist", "Track", "Label", "Year"]
Table.new
|> Table.add_rows(rows)
|> Table.set_header(header)
|> Table.set_header_meta(0, align: :left)
|> Table.set_header_meta(2, align: :right)
|> Table.render!
|> IO.puts
+-----------------+---------------+-------------------+------+
| Artist          |     Track     |             Label | Year |
+-----------------+---------------+-------------------+------+
|    Konflict     |    Cyanide    | Renegade Hardware | 1999 |
+-----------------+---------------+-------------------+------+

This example looks funky but there are cases where the headers need to be aligned separately from the column data below.

@djm djm added this to the 1.0.0 milestone Dec 29, 2015
@djm djm closed this as completed in 707e34c Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant