-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Use correct offset in snapshot (#2318)
- Was using `row.offsetInSnapshot`, which was a "protected" API and recently removed from the JS API - API was removed in JS API refactoring: deephaven/deephaven-core#5890 - Instead just use the viewport `offset` and add the index of the row in the snapshot, which is there in both versions of the API - New API does support `row.index`, but this way is compatible with both - Updated unit tests - Tested using a deephaven.ui.list_view: ```python from deephaven import time_table, ui import datetime initial_row_count = 200 column_types = time_table( "PT1S", start_time=datetime.datetime.now() - datetime.timedelta(seconds=initial_row_count), ).update( [ "Id=new Integer(i)", "Display=new String(`Display `+i)", ] ) @ui.component def ui_list_view_table(): value, set_value = ui.use_state([]) lv = ui.list_view( column_types, aria_label="List View", on_change=set_value, selected_keys=value, ) text = ui.text("Selection: " + ", ".join(map(str, value))) return ui.flex( lv, text, direction="column", margin=10, gap=10, width=500, # necessary to avoid overflowing container height min_height=0, ) lv_table = ui_list_view_table() ``` (cherry picked from commit a479d6c)
- Loading branch information
Showing
3 changed files
with
17 additions
and
57 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
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