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

[freqtbl-] Allow renaming of count column in Frequency Table #2348

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

anjakefala
Copy link
Collaborator

@anjakefala anjakefala commented Mar 15, 2024

Previously, if the count column was renamed, the entire sheet would fail to draw.

What was happening was that drawColHeader was using sheet.column() to grab the Column objects that needed a sort icon added to them. Since this commit the 'count' column name was being added to _ordering. When the column got renamed, sheet.column() could not find a column named 'count', and it issued a vd.fail().

This PR includes two changes:

  1. Now, drawColHeader will silently not add a sort icon if it is unable to find a column by its string. I am open to adding a warning message, I just thought it might be noisy with the rate of draw cycles.
  2. Frequency Table adds the count column object to _ordering instead of its name. This allows it to keep its sort-icon even if it gets renamed.

If _ordering contains a string, when adding the sort icon, drawColHeader
is unable to find a renamed column. If passing the column object
directly, it will be able to identify the column to sort by, even if
renamed.
self.column will vd.fail() if a column stored as a string was renamed.
The entire sheet will fail to draw. Better to just silently drop the
sort icon.
@anjakefala anjakefala requested a review from saulpw March 15, 2024 02:49
Copy link
Owner

@saulpw saulpw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, thanks for fixing this @anjakefala ! and thanks to @jsvine for finding it.

@anjakefala anjakefala merged commit 2dfde8a into develop Mar 15, 2024
13 checks passed
@anjakefala anjakefala deleted the kef/rename-count branch March 15, 2024 20:17
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

Successfully merging this pull request may close these issues.

None yet

2 participants