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

Custom top and bottom table style #218

Open
manoelmozzer opened this issue Aug 5, 2022 · 5 comments
Open

Custom top and bottom table style #218

manoelmozzer opened this issue Aug 5, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@manoelmozzer
Copy link

First, thanks for the great library. It is excellent.

It would be nice to be able to customize the first and last rows of the table different from the middle ones.

From what I've seen, MiddleHorizontal (t.Style().Box.MiddleHorizontal) controls the style of all horizontal lines. However, it would be nice to have independent Top and Bottom options.

These options could generate the following tables, which I didn't get in the current settings:

   #   FIRST NAME   LAST NAME   SALARY                                  <- no top line
----- ------------ ----------- -------- -----------------------------
   1   Arya         Stark         3000                               
  20   Jon          Snow          2000   You know nothing, Jon Snow! 
 300   Tyrion       Lannister     5000                               
----- ------------ ----------- -------- -----------------------------
                    TOTAL        10000                               
----- ------------ ----------- -------- ----------------------------- <- with bottom line
=====+============+===========+========+============================= <- diferrent styles
   # | FIRST NAME | LAST NAME | SALARY |                             
-----+------------+-----------+--------+----------------------------- <- diferrent styles
   1 | Arya       | Stark     |   3000 |                             
  20 | Jon        | Snow      |   2000 | You know nothing, Jon Snow! 
 300 | Tyrion     | Lannister |   5000 |                             
-----+------------+-----------+--------+-----------------------------
     |            | TOTAL     |  10000 |                             
=====+============+===========+========+=============================
^^^^^+^^^^^^^^^^^^+^^^^^^^^^^^+^^^^^^^^+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- diferrent styles
   # | FIRST NAME | LAST NAME | SALARY |                             
-----+------------+-----------+--------+----------------------------- <- diferrent styles
   1 | Arya       | Stark     |   3000 |                             
  20 | Jon        | Snow      |   2000 | You know nothing, Jon Snow! 
 300 | Tyrion     | Lannister |   5000 |                             
-----+------------+-----------+--------+-----------------------------
     |            | TOTAL     |  10000 |                             
~~~~~+~~~~~~~~~~~~+~~~~~~~~~~~+~~~~~~~~+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <- diferrent styles

With this feature, custom styles would become more generic.

@jedib0t
Copy link
Owner

jedib0t commented Aug 5, 2022

This is possible to do. Will try to get this implemented.

@jedib0t jedib0t self-assigned this Aug 5, 2022
@jedib0t jedib0t added the enhancement New feature or request label Aug 5, 2022
@jedib0t
Copy link
Owner

jedib0t commented Aug 6, 2022

The implementation is complex simply because this introduces a LOT of edge cases (literally). Just thought I'd let you know to not expect this soon. Will update this thread when I make some progress.

@jedib0t
Copy link
Owner

jedib0t commented Nov 6, 2022

Hey @manoelmozzer ... I honestly tried to make this customization work, but the more I worked on it, the more it felt like a lot of code quality/simplicity/maintainability had to be sacrificed to make this work.

I have code that can stylize Title/Header/Rows/Footers all separately in their own individual styles. But this change required a bunch of backward-incompatible changes and a major version bump along with making the code really hard to read/reason/maintain.

I'll leave this issue open, and if a lot more folks ask for this feature, I'll see what I can do. But for now, I'm gonna stop working on this. Sorry! 😞

@manoelmozzer
Copy link
Author

No problem, thanks for your try. Anyway, your library is great. xD

@stingshen
Copy link

RST grid table can be rendered if this feature is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants