-
Notifications
You must be signed in to change notification settings - Fork 28
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
Can't add a separator before last row #14
Comments
@zzantares Sadly it doesn't support this at the moment.
We have This is a substantial amount of work, I will attempt to get to it soon but I can't make any promises unless someone else would like to pick it up (and we can then better spec out what the new API would look like). |
Thanks a lot for the honest words, no worries, in the mean time I added a row with I'll keep an eye in the project for this to be implemented. Thanks! |
That's one hack, another probably visually better hack is to take advantage of the fact it just returns a string and insert a new row that way. Given the example: header = ["Artist", "Track", "Label", "Year"]
rows = [
["Konflict", "Cyanide", "Renegade Hardware", 1999],
["Marcus Intalex", "Temperance", "Soul:r", 2004],
["Kryptic Minds", "The Forgotten", "Defcom Records", 2007]
]
# Split the output on new lines and store the list for later.
table = TableRex.quick_render!(rows, header) |> String.split("\n")
# Take the first line as we can duplicate it and reinsert.
separator = table |> Enum.at(0)
table
# Reinsert the separator line into the table list.
|> List.insert_at(-4, separator)
# Turn the table list back into a newline-joined string.
|> Enum.join("\n")
# To display it.
|> IO.puts Output would look like this:
Hope it helps? Wish it was a proper solution. I'm leaving this ticket open to serve as a reminder both to me when I get a chance or anyone that wants to pick it up. |
Thanks @djm, I've modified my code accordingly, your suggestion looks just the way I wanted. Thanks! |
Hi, just getting started with this lib, however I need to add a separator before the last row and I don't see how, is it possible to do it?
That final row (
Total
) how could I divide it from the other above it? Is it possible?Thanks!
The text was updated successfully, but these errors were encountered: