From 312f9acae5b0e5532be45cf57d7052078fea3f74 Mon Sep 17 00:00:00 2001 From: Josh Duncan <44387852+joshbduncan@users.noreply.github.com> Date: Tue, 29 Aug 2023 23:47:35 -0400 Subject: [PATCH] removed unecessary code from example - the sort by clicked column function was bloat in my opinion --- docs/examples/widgets/data_table_sort.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/docs/examples/widgets/data_table_sort.py b/docs/examples/widgets/data_table_sort.py index 73669601be..d88223b9af 100644 --- a/docs/examples/widgets/data_table_sort.py +++ b/docs/examples/widgets/data_table_sort.py @@ -1,7 +1,6 @@ from rich.text import Text from textual.app import App, ComposeResult -from textual.events import Click from textual.widgets import DataTable, Footer ROWS = [ @@ -81,18 +80,6 @@ def action_sort_by_country(self) -> None: reverse=self.sort_reverse("country"), ) - def on_data_table_header_selected(self, event: Click) -> None: - """Sort `DataTable` items by the clicked column header.""" - - def sort_by_plain_text(cell): - return cell.plain if isinstance(cell, Text) else cell - - column_key = event.column_key - table = self.query_one(DataTable) - table.sort( - column_key, key=sort_by_plain_text, reverse=self.sort_reverse(column_key) - ) - app = TableApp() if __name__ == "__main__":