Skip to content

Commit

Permalink
use row data
Browse files Browse the repository at this point in the history
  • Loading branch information
dgodinez-dh committed Jan 28, 2025
1 parent 38cb760 commit d4e1503
Showing 1 changed file with 19 additions and 0 deletions.
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.

```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

0 comments on commit d4e1503

Please sign in to comment.