Hiding columns?
I have been hiding columns by setting the column size to zero:
self.columnwidths[c] = 0
But this often winds up with the hidden column headers showing up anyway, which looks ugly even if I stick it at the end of the table.
Looking at the code, it looks like you can set which columns are visible by setting visiblecols variable. However on closer inspection, I see that visiblecols is reset anytime you call redraw.
startvisiblecol, endvisiblecol = self.getVisibleCols(x1, x2)
self.visiblecols = list(range(startvisiblecol, endvisiblecol))
Anyway, is there any clean way to either set the visible column range or else have the column headers not show up for columns with a zero width?
visiblecols refers to the columns visible in the frame, so that only those are redrawn. That's why it's recalculated on every redraw. It's not to do with hiding specific columns. I would not change those values. I need to comment some of these variables.. I use a minimum column size > 0 so that if someone drags it down they can still see there's a column there. It's not a problem to make them zero which should be an option I agree but how do you suggest the user is to recover the hidden column.
Hi, i think you can update the model of the table by removing this column in your data frame (if you are doing this with pandas)
On Sat, Aug 17, 2019 at 6:39 AM Arbitrager [email protected] wrote:
I have been hiding columns by setting the column size to zero:
self.columnwidths[c] = 0
But this often winds up with the hidden column headers showing up anyway, which looks ugly even if I stick it at the end of the table.
Looking at the code, it looks like you can set which columns are visible by setting visiblecols variable. However on closer inspection, I see that visiblecols is reset anytime you call redraw.
startvisiblecol, endvisiblecol = self.getVisibleCols(x1, x2) self.visiblecols = list(range(startvisiblecol, endvisiblecol))
Anyway, is there any clean way to either set the visible column range or else have the column headers not show up for columns with a zero width?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dmnfarrell/pandastable/issues/146?email_source=notifications&email_token=AJGP5G6VGFSWFRZ4S567JODQE7POBA5CNFSM4IMPEZQ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HFY3WIQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AJGP5G354VD25JCIALXNUGDQE7POBANCNFSM4IMPEZQQ .
@JayLi2018 That would remove the column altogether. I think he just wants to hide it.
Yeah basically I have some columns in the df that are needed for various functions but it would be prettier if the user never saw them. A simple example is where I want to show a numeric column with formatting, but I may need the numeric version for other reasons. What I do is create a column with the formatted version of the letters AND a column with the original number.
Like I say, setting column width to zero kind of works. but this winds up happening:

Yes the column header is drawn separately so you'd have to handle that aswell. Making hidden columns work is possible but a bit trickier than I thought at first.
I think the best way to ultimately handle this is to have two df's, one for display and the other for calculations.