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

docs: update work with tables #1098

Merged
merged 11 commits into from
Jan 29, 2025
19 changes: 19 additions & 0 deletions plugins/ui/docs/describing/ui_with_tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ def ui_table_data(table):
table_data_example = ui_table_data(time_table("PT1s").update("x=i").tail(5))
```

The [`use_row_data`](../hooks/use_row_data.md) hook lets you use the first row of table data a dictionary. This example displays the latest row of data in a ticking time table.
dgodinez-dh marked this conversation as resolved.
Show resolved Hide resolved

```python
from deephaven import time_table, ui


@ui.component
def ui_table_first_cell(table):
row_data = ui.use_row_data(table)
return [
ui.heading("Latest data"),
ui.text(f"Timestamp: {row_data['Timestamp']}"),
ui.text(f"x: {row_data['x']}"),
]


table_first_cell2 = ui_table_first_cell(time_table("PT1s").update("x=i").reverse())
```

The [`use_cell_data`](../hooks/use_cell_data.md) hook lets you use the cell data of the first cell (first row in the first column) in a table. This value can be used for conditional rendering as shown in this example.

```python
Expand Down
Loading