Commit a479d6c
authored
fix: Use correct offset in snapshot (#2217)
- 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()
```1 parent 99b8d59 commit a479d6c
3 files changed
Lines changed: 17 additions & 57 deletions
File tree
- packages
- jsapi-components/src
- jsapi-utils/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | 25 | | |
31 | 26 | | |
32 | | - | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| |||
213 | 208 | | |
214 | 209 | | |
215 | 210 | | |
216 | | - | |
| 211 | + | |
217 | 212 | | |
218 | 213 | | |
219 | 214 | | |
220 | 215 | | |
221 | 216 | | |
222 | 217 | | |
223 | | - | |
| 218 | + | |
224 | 219 | | |
225 | 220 | | |
226 | 221 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 19 | | |
26 | 20 | | |
27 | 21 | | |
| |||
44 | 38 | | |
45 | 39 | | |
46 | 40 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 41 | | |
61 | 42 | | |
62 | 43 | | |
63 | 44 | | |
64 | | - | |
65 | | - | |
66 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
67 | 48 | | |
68 | | - | |
| 49 | + | |
69 | 50 | | |
70 | 51 | | |
71 | 52 | | |
| |||
107 | 88 | | |
108 | 89 | | |
109 | 90 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
114 | 96 | | |
115 | 97 | | |
116 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
| |||
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 30 | | |
48 | 31 | | |
49 | 32 | | |
| |||
66 | 49 | | |
67 | 50 | | |
68 | 51 | | |
69 | | - | |
| 52 | + | |
70 | 53 | | |
71 | | - | |
| 54 | + | |
72 | 55 | | |
73 | 56 | | |
74 | 57 | | |
| |||
86 | 69 | | |
87 | 70 | | |
88 | 71 | | |
89 | | - | |
| 72 | + | |
90 | 73 | | |
91 | 74 | | |
92 | 75 | | |
| |||
0 commit comments