From be6dacf943eef300a66e79642bdf5eee556b6f17 Mon Sep 17 00:00:00 2001 From: Don Date: Thu, 28 Aug 2025 12:24:49 -0400 Subject: [PATCH 1/3] docs: ui.TableFormat text alignment property example --- plugins/ui/docs/components/table.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/ui/docs/components/table.md b/plugins/ui/docs/components/table.md index 2d11d5830..bfd5bac96 100644 --- a/plugins/ui/docs/components/table.md +++ b/plugins/ui/docs/components/table.md @@ -172,6 +172,24 @@ t = ui.table( ) ``` +### Formatting cell text alignment + +You can control text alignment using the alignment property in the ui.TableFormat class. This property accepts the values left, center, and right, overriding the default alignment based on the column type. By default, numeric columns are right-aligned, string columns are left-aligned, and date columns are center-aligned. + +```python +from deephaven import ui +import deephaven.plot.express as dx + +t = ui.table( + dx.data.stocks(), + format_=[ + ui.TableFormat(cols="Sym", alignment="right"), + ui.TableFormat(cols="Exchange", alignment="center"), + ui.TableFormat(cols="Size", alignment="left"), + ], +) +``` + ## Aggregations You can add aggregation rows to the table using `ui.TableAgg` with the `aggregations` prop. These will be shown as floating rows at the top or bottom of the table and account for any user-applied filters. The `aggregations_position` prop determines if aggregations are shown at the top or bottom of the table and defaults to the bottom. The full list of aggregations can be found in the "Aggregate Columns" section in the table sidebar menu and in our [JavaScript API docs](/core/client-api/javascript/classes/dh.AggregationOperation.html). From 1397813c298cc45f46776f2a5052f792649f44bd Mon Sep 17 00:00:00 2001 From: Don Date: Thu, 28 Aug 2025 14:02:22 -0400 Subject: [PATCH 2/3] add snapshot --- plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json diff --git a/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json b/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json new file mode 100644 index 000000000..c0e79c01f --- /dev/null +++ b/plugins/ui/docs/snapshots/d6058276014693898f04ab2b12370116.json @@ -0,0 +1 @@ +{"file":"components/table.md","objects":{"t":{"type":"deephaven.ui.Element","data":{"document":{"__dhElemName":"deephaven.ui.elements.UITable","props":{"table":{"__dhObid":0},"format_":[{"cols":"Sym","alignment":"right"},{"cols":"Exchange","alignment":"center"},{"cols":"Size","alignment":"left"}],"showQuickFilters":false,"showGroupingColumn":true,"showSearch":false,"reverse":false}},"state":"{}"}}}} \ No newline at end of file From b87635e64a4dfdcd35b75f6168ae20fd5c4ac9e1 Mon Sep 17 00:00:00 2001 From: dsmmcken Date: Fri, 5 Sep 2025 10:27:41 -0400 Subject: [PATCH 3/3] review feedback --- plugins/ui/docs/components/table.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ui/docs/components/table.md b/plugins/ui/docs/components/table.md index bfd5bac96..f44d6ec2c 100644 --- a/plugins/ui/docs/components/table.md +++ b/plugins/ui/docs/components/table.md @@ -174,7 +174,7 @@ t = ui.table( ### Formatting cell text alignment -You can control text alignment using the alignment property in the ui.TableFormat class. This property accepts the values left, center, and right, overriding the default alignment based on the column type. By default, numeric columns are right-aligned, string columns are left-aligned, and date columns are center-aligned. +You can control text alignment using the `alignment` property. This property accepts the values `left`, `center`, and `right`, overriding the default alignment based on the column type. By default, numeric columns are right-aligned, string columns are left-aligned, and date columns are center-aligned. ```python from deephaven import ui