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

Hiding columns? #146

Open
arbitrager44 opened this issue Aug 17, 2019 · 6 comments
Open

Hiding columns? #146

arbitrager44 opened this issue Aug 17, 2019 · 6 comments

Comments

@arbitrager44
Copy link

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?

@dmnfarrell
Copy link
Owner

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.

@JayLi2018
Copy link

JayLi2018 commented Aug 19, 2019 via email

@dmnfarrell
Copy link
Owner

@JayLi2018 That would remove the column altogether. I think he just wants to hide it.

@arbitrager44
Copy link
Author

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:

image

@dmnfarrell
Copy link
Owner

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.

@arbitrager44
Copy link
Author

I think the best way to ultimately handle this is to have two df's, one for display and the other for calculations.

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

3 participants