-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Move functions to be keyword args on ui.table call instead
- Loading branch information
Showing
4 changed files
with
119 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,44 @@ | ||
from deephaven.table import Table | ||
from ..elements import UITable | ||
from ..types import ( | ||
CellPressCallback, | ||
ColumnPressCallback, | ||
RowPressCallback, | ||
) | ||
|
||
|
||
def table(table: Table) -> UITable: | ||
def table( | ||
table: Table, | ||
*, | ||
on_row_press: RowPressCallback | None = None, | ||
on_row_double_press: RowPressCallback | None = None, | ||
on_cell_press: CellPressCallback | None = None, | ||
on_cell_double_press: CellPressCallback | None = None, | ||
on_column_press: ColumnPressCallback | None = None, | ||
on_column_double_press: ColumnPressCallback | None = None, | ||
) -> UITable: | ||
""" | ||
Add some extra methods to the Table class for giving hints to displaying a table | ||
Customization to how a table is displayed, how it behaves, and listen to UI events. | ||
Args: | ||
table: The table to wrap | ||
on_row_press: The callback function to run when a row is clicked. | ||
The first parameter is the row index, and the second is the row data provided in a dictionary where the | ||
column names are the keys. | ||
on_row_double_press: The callback function to run when a row is double clicked. | ||
The first parameter is the row index, and the second is the row data provided in a dictionary where the | ||
column names are the keys. | ||
on_cell_press: The callback function to run when a cell is clicked. | ||
The first parameter is the cell index, and the second is the row data provided in a dictionary where the | ||
column names are the keys. | ||
on_cell_double_press: The callback function to run when a cell is double clicked. | ||
The first parameter is the cell index, and the second is the row data provided in a dictionary where the | ||
column names are the keys. | ||
on_column_press: The callback function to run when a column is clicked. | ||
The first parameter is the column name. | ||
on_column_double_press: The callback function to run when a column is double clicked. | ||
The first parameter is the column name. | ||
""" | ||
return UITable(table) | ||
props = locals() | ||
del props["table"] | ||
return UITable(table, **props) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters