Skip to content

fix: DH-22174: ui.table works with rollup and tree tables#1343

Open
mofojed wants to merge 6 commits intodeephaven:mainfrom
mofojed:DH-22174-ui-table-with-rollup
Open

fix: DH-22174: ui.table works with rollup and tree tables#1343
mofojed wants to merge 6 commits intodeephaven:mainfrom
mofojed:DH-22174-ui-table-with-rollup

Conversation

@mofojed
Copy link
Copy Markdown
Member

@mofojed mofojed commented Apr 30, 2026

  • Added e2e tests to verify ui.table works with rollup and tree tables
  • Can set formatting on the table as well
    • CAVEAT: Does not support _if conditional formatting when used with rollup tables. This will error early when validating the Python.
  • Verified the code snippet from the ticket works correctly:
from deephaven import new_table, agg
from deephaven.column import string_col, double_col
from deephaven import ui

raw = new_table([
    string_col("Group",    ["A", "A", "A", "B", "B", "B"]),
    string_col("Person",  ["Alice", "Alice", "Bob", "Bob", "Carol", "Carol"]),
    double_col("Value1",     [1234.56, -789.12, 3210.99, 4567.89, -123.45, 9876.54]),
    double_col("Value2",     [50000.33, 30000.77, 45000.50, 120000.11, 80000.99, 200000.44]),
    double_col("Pct", [0.0512, 0.0623, 0.0310, 0.0234, 0.0345, 0.0178]),
])

rollup_table = raw.rollup(
    aggs=[agg.sum_(["Value1", "Value2"]), agg.avg(["Pct"])],
    by=["Group", "Person"],
    include_constituents=True,
)

rollup_fmt = ui.table(
    rollup_table,
    format_=[
        ui.TableFormat(background_color="fg"),
        ui.TableFormat(cols="Group", color="accent"),
    ],
)

mofojed added 4 commits April 23, 2026 13:39
- I don't think formatting works yet
applyCustomColumns on a rollup TreeTable adds the column to the source
rather than the aggregated output, so the if_ format column is not
visible on the rollup itself and findColumn throws NoSuchElementException
when the table is loaded.

Validate up front in Python and raise ValueError when if_ is used with a
RollupTable or TreeTable. Also throw a defensive error in the JS model
if the case ever slips through. Remove the t_rollup_format_if test case
that exercised the now-rejected combination.
@mofojed mofojed requested a review from a team April 30, 2026 15:13
@mofojed mofojed self-assigned this Apr 30, 2026
@mofojed mofojed requested review from ethanalvizo and jnumainville and removed request for a team and ethanalvizo April 30, 2026 15:13
@github-actions
Copy link
Copy Markdown

ui docs preview (Available for 14 days)

mofojed added 2 commits May 1, 2026 10:12
Split shared table proxy logic into a generic JsBaseTableProxy base class and add a dedicated JsTreeTableProxy for TreeTable (including rollup) so TreeTables no longer reuse JsTableProxy.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

ui docs preview (Available for 14 days)

def _validate_table_format(format_: list[TableFormat] | TableFormat) -> None:
def _validate_table_format(
format_: list[TableFormat] | TableFormat,
table: Table | RollupTable | TreeTable | UriElement | str,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth creating a type for all these, something like TableLike? In __init__ below too.

Comment on lines +94 to +109
const {
frontColumns = null,
frozenColumns = null,
backColumns = null,
hiddenColumns = null,
columnGroups = null,
} = layoutHints;

this.layoutHints = {
frontColumns,
frozenColumns,
backColumns,
hiddenColumns,
columnGroups,
areSavedLayoutsAllowed: false,
};
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was pretty much just moved... but could be this to remove some redundancy:

this.layoutHints = {
  frontColumns: null,
  frozenColumns: null,
  backColumns: null,
  hiddenColumns: null,
  columnGroups: null,
  ...layoutHints,
  areSavedLayoutsAllowed: false,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants