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

Support clearing columns via DataTable.clear() #1273

Closed
JoshKarpel opened this issue Nov 24, 2022 · 1 comment · Fixed by #1427
Closed

Support clearing columns via DataTable.clear() #1273

JoshKarpel opened this issue Nov 24, 2022 · 1 comment · Fixed by #1427

Comments

@JoshKarpel
Copy link
Contributor

JoshKarpel commented Nov 24, 2022

Looks like this feature must have gotten lost in the shuffle, since the docstring mentions it but the function doesn't support it:

def clear(self) -> None:
"""Clear the table.
Args:
columns (bool, optional): Also clear the columns. Defaults to False.
"""
self.row_count = 0
self._clear_caches()
self._y_offsets.clear()
self.data.clear()
self.rows.clear()
self._line_no = 0
self._require_update_dimensions = True
self.refresh()

Happy to do a PR for this. Is it as simple as running self.columns.clear() if the columns argument is True?

@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

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 a pull request may close this issue.

1 participant