You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Move always fetch columns section to events documentation (#1254)
- [x] Analyze repository structure and locate the table.md file
- [x] Understand current documentation structure
- [x] Move "Always fetching some columns" section from line 613-634 to
be within the "Events" section (now at line 430)
- [x] Add best practices information about including callback columns in
always_fetch_columns
- [x] Explain the rationale about avoiding undefined columns when users
hide columns or scroll far right where original columns are no longer in
viewport
- [x] Update the section to be a subsection within Events (### instead
of ##)
- [x] Ensure all cross-references and examples still work correctly
- [x] Verify documentation structure and markdown syntax is valid
- [x] Clean up extra blank lines from the move operation
- [x] Rewrite best practice tip as shorter body text without callout
formatting per feedback
- [x] Reorganize Events section per arman's feedback:
- [x] Move "Always fetching some columns" to end of Events section
(after Selection Events)
- [x] Add sentence and link to always_fetch_columns in Press Events
section
- [x] Add link to always_fetch_columns in Selection Events section
- [x] Rename "Selection Event" to "Selection Events" for consistency
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
> Create a PR to move the always fetch columns section to be withn the
events section
</details>
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: dsmmcken <[email protected]>
Co-authored-by: Don <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Copy file name to clipboardExpand all lines: plugins/ui/docs/components/table.md
+28-26Lines changed: 28 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -404,7 +404,7 @@ t_top = ui.table(
404
404
405
405
### Press Events
406
406
407
-
You can listen for different user press events on a `ui.table`. There is both a `press` and `double_press` event for `row`, `cell`, and `column`. These events typically correspond to a click or double click on the table. The event payloads include table data related to the event. For `row` and `column` events, the corresponding data within the viewport will be sent to the event handler. The viewport is typically the visible area ± a window equal to the visible area (e.g., if rows 5-10 are visible, rows 0-15 will be in the viewport).
407
+
You can listen for different user press events on a `ui.table`. There is both a `press` and `double_press` event for `row`, `cell`, and `column`. These events typically correspond to a click or double click on the table. The event payloads include table data related to the event. For `row` and `column` events, the corresponding data within the viewport will be sent to the event handler. The viewport is typically the visible area ± a window equal to the visible area (e.g., if rows 5-10 are visible, rows 0-15 will be in the viewport). Data specified via [`always_fetch_columns`](#always-fetching-some-columns) is also included.
408
408
409
409
Note that there is no row index in event data because the row index is not a safe way to reference a row between the client and server since the user could have manipulated the table, resulting in a different client order.
410
410
@@ -427,11 +427,11 @@ t = ui.table(
427
427
)
428
428
```
429
429
430
-
### Selection Event
430
+
### Selection Events
431
431
432
432
The `on_selection_change` event is triggered when the user selects or deselects a row. The event data will contain all selected rows within the viewport as a list of dictionaries keyed by column name. There are a few caveats to the selection event.
433
433
434
-
1. The event will **only** send data from columns in the `always_fetch_columns` prop.
434
+
1. The event will **only** send data from columns in the [`always_fetch_columns`](#always-fetching-some-columns) prop.
435
435
2. The event will **only** send data from rows that are visible in the viewport.
436
436
3. The event will **not** be triggered if a ticking table row is replaced or shifted. This may cause what the user sees after row shifts to differ from the selection event data.
437
437
@@ -448,6 +448,31 @@ t = ui.table(
448
448
)
449
449
```
450
450
451
+
### Always fetching some columns
452
+
453
+
Deephaven only fetches data for visible rows and columns within a window around the viewport (typically the viewport plus 1 page in all directions). This reduces the amount of data transferred between the server and client and allows tables with billions of rows to be displayed. Sometimes you may need to always fetch columns, such as a key column for a row press event. You can use the `always_fetch_columns` prop to specify columns that should always be fetched regardless of their visibility.
454
+
455
+
The `always_fetch_columns` prop takes a single column name, a list of column names, or a boolean to always fetch all columns. The data for these columns is included in row event data (e.g., `on_row_press`) and context menu callbacks.
456
+
457
+
When using event callbacks, include any columns referenced in the callback in `always_fetch_columns` to prevent undefined columns when users hide columns or scroll beyond the viewport.
458
+
459
+
> [!WARNING]
460
+
> Setting `always_fetch_columns` to `True` will fetch all columns and can be slow for tables with many columns.
461
+
462
+
This example shows how to use `always_fetch_columns` to always fetch the `Sym` column for a row press event. Without the `always_fetch_columns` prop, the press callback will fail because the `Sym` column is not fetched when hidden.
463
+
464
+
```python
465
+
from deephaven import ui
466
+
import deephaven.plot.express as dx
467
+
468
+
t = ui.table(
469
+
dx.data.stocks(),
470
+
hidden_columns=["Sym"],
471
+
on_row_press=lambdad: print(d["Sym"]),
472
+
always_fetch_columns="Sym",
473
+
)
474
+
```
475
+
451
476
## Context menu
452
477
453
478
Items can be added to the bottom of the `ui.table` context menu (right-click menu) by using the `context_menu` or `context_header_menu` props. The `context_menu` prop adds items to the cell context menu, while the `context_header_menu` prop adds items to the column header context menu. You can pass either a single dictionary for a single item or a list of dictionaries for multiple items.
@@ -610,29 +635,6 @@ t = ui.table(
610
635
611
636

612
637
613
-
## Always fetching some columns
614
-
615
-
Deephaven only fetches data for visible rows and columns within a window around the viewport (typically the viewport plus 1 page in all directions). This reduces the amount of data transferred between the server and client and allows displaying tables with billions of rows. Sometimes you may need to always fetch columns, such as a key column for a row press event. You can use the `always_fetch_columns` prop to specify columns that should always be fetched regardless of their visibility.
616
-
617
-
The `always_fetch_columns` prop takes a single column name, a list of column names, or a boolean to always fetch all columns. The data for these columns is included in row event data (e.g. `on_row_press`) and context menu callbacks.
618
-
619
-
> [!WARNING]
620
-
> Setting `always_fetch_columns` to `True` will fetch all columns and can be slow for tables with many columns.
621
-
622
-
This example shows how to use `always_fetch_columns` to always fetch the `Sym` column for a row press event. Without the `always_fetch_columns` prop, the press callback will fail because the `Sym` column is not fetched when hidden.
623
-
624
-
```python
625
-
from deephaven import ui
626
-
import deephaven.plot.express as dx
627
-
628
-
t = ui.table(
629
-
dx.data.stocks(),
630
-
hidden_columns=["Sym"],
631
-
on_row_press=lambdad: print(d["Sym"]),
632
-
always_fetch_columns="Sym",
633
-
)
634
-
```
635
-
636
638
## Quick filters
637
639
638
640
Quick filters are an easy way to filter the table while also showing the user what filters are currently applied. These filters are applied on the server via request from the client, so users may change the filters without affecting other users. Unlike a `where` statement to filter a table on the server, quick filters can be easily changed by the user.
0 commit comments