josephsoo commited on
Commit
6c36ff6
·
1 Parent(s): 10536f4

Wire consistency table header sorting

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1290,9 +1290,10 @@ app.layout = html.Div(
1290
  "consistency-table",
1291
  page_size=23,
1292
  max_height="520px",
 
1293
  sort_by=[{"column_id": "alignment_score", "direction": "desc"}],
1294
  ),
1295
- html.P("Click a method to update the 3D latent view.", className="table-hint"),
1296
  ],
1297
  className="consistency-table-wrap",
1298
  ),
@@ -1437,12 +1438,13 @@ def update_leaderboard(dataset: str, sort_by: list[dict] | None):
1437
  Output("consistency-heatmap", "figure"),
1438
  Input("dataset-filter", "value"),
1439
  Input("consistency-table", "active_cell"),
 
1440
  )
1441
- def update_consistency(dataset: str, active_cell: dict | None):
1442
  df = consistency_frame(dataset, None)
1443
  model = selected_consistency_model(df, active_cell)
1444
  visible_cols = ["method", "alignment_score", "n_sessions", "latent_dim", "n_pairwise"]
1445
- sorted_df = sort_table(df, None, [("alignment_score", False), ("model_order", True)])
1446
  table_df = sorted_df[[c for c in visible_cols + ["id", "model"] if c in sorted_df.columns]]
1447
  return (
1448
  column_defs([c for c in visible_cols if c in table_df.columns]),
 
1290
  "consistency-table",
1291
  page_size=23,
1292
  max_height="520px",
1293
+ sort_action="custom",
1294
  sort_by=[{"column_id": "alignment_score", "direction": "desc"}],
1295
  ),
1296
+ html.P("Click a column header to sort. Click a method row to update the 3D latent view.", className="table-hint"),
1297
  ],
1298
  className="consistency-table-wrap",
1299
  ),
 
1438
  Output("consistency-heatmap", "figure"),
1439
  Input("dataset-filter", "value"),
1440
  Input("consistency-table", "active_cell"),
1441
+ Input("consistency-table", "sort_by"),
1442
  )
1443
+ def update_consistency(dataset: str, active_cell: dict | None, sort_by: list[dict] | None):
1444
  df = consistency_frame(dataset, None)
1445
  model = selected_consistency_model(df, active_cell)
1446
  visible_cols = ["method", "alignment_score", "n_sessions", "latent_dim", "n_pairwise"]
1447
+ sorted_df = sort_table(df, sort_by, [("alignment_score", False), ("model_order", True)])
1448
  table_df = sorted_df[[c for c in visible_cols + ["id", "model"] if c in sorted_df.columns]]
1449
  return (
1450
  column_defs([c for c in visible_cols if c in table_df.columns]),