Commit c25f578
authored
feat: Column sources for ui.table formatting (#1010)
Fixes #984
Allows all string format values to instead specify a column as the
source. Ensures the column is always fetched and throws if the column is
not a string type (can cause some really bad performance issues if value
formatting is invalid). Also modified to just resolve all theme colors
since this change could lead to unresolved theme colors in a column
source.
The example in the docs or this example shows the feature working.
Change the String cast on line 6 to non-string to test the error is
thrown and displayed.
This example uses an input table joined to the table so you can adjust
the formatting colors via input table (something Raffi asked about
specifically)
```py
from deephaven import input_table
from deephaven import ui
import deephaven.plot.express as dx
_stocks = dx.data.stocks()
_source = _stocks.select_distinct("Sym").update("Color=(String)null")
color_source = input_table(init_table=_source, key_cols="Sym")
t = ui.table(
_stocks.natural_join(color_source, "Sym", "SymColor=Color"),
hidden_columns=["SymColor"],
format_=[
ui.TableFormat(cols="Sym", background_color="SymColor")
],
)
```1 parent 1343ec8 commit c25f578
File tree
9 files changed
+98
-20
lines changed- plugins/ui
- docs/components
- src/js/src/elements/UITable
- tests
- app.d
- ui_table.spec.ts-snapshots
9 files changed
+98
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
69 | 87 | | |
70 | 88 | | |
71 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
| |||
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | 22 | | |
| |||
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
42 | | - | |
43 | | - | |
44 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
| |||
162 | 174 | | |
163 | 175 | | |
164 | 176 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
176 | 181 | | |
177 | 182 | | |
178 | 183 | | |
| |||
183 | 188 | | |
184 | 189 | | |
185 | 190 | | |
186 | | - | |
| 191 | + | |
187 | 192 | | |
188 | 193 | | |
189 | 194 | | |
| |||
256 | 261 | | |
257 | 262 | | |
258 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
259 | 287 | | |
260 | 288 | | |
261 | | - | |
262 | | - | |
263 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
264 | 293 | | |
265 | 294 | | |
266 | 295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
442 | 461 | | |
443 | 462 | | |
444 | 463 | | |
445 | 464 | | |
446 | 465 | | |
447 | | - | |
| 466 | + | |
448 | 467 | | |
449 | 468 | | |
450 | 469 | | |
451 | 470 | | |
452 | 471 | | |
453 | 472 | | |
454 | 473 | | |
455 | | - | |
| 474 | + | |
456 | 475 | | |
457 | 476 | | |
458 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
0 commit comments