feat(grid): columnDefs + fabrique ag_grid (#41)

This commit is contained in:
Colin Maudry
2026-07-10 08:05:19 +02:00
parent 2ce52d9eab
commit 97e1d0b5de
3 changed files with 106 additions and 1 deletions
+27
View File
@@ -2,6 +2,7 @@ import math
from datetime import datetime
from typing import Literal
import dash_ag_grid as dag
import dash_bootstrap_components as dbc
import dash_leaflet as dl
import dash_leaflet.express as dlx
@@ -1066,3 +1067,29 @@ def get_top_org_table(data, org_type: str, extra_columns: list, filters: bool =
tooltip_header=tooltip,
filter_action="native" if filters else "none",
)
def ag_grid(grid_id: str, column_defs: list[dict]) -> "dag.AgGrid":
"""Grille AG Grid server-side (infinite) pour la page Tableau.
Apparence de base d'AG Grid (aucun thème custom au Lot 1).
"""
return dag.AgGrid(
id=grid_id,
columnDefs=column_defs,
defaultColDef={"resizable": True, "minWidth": 120, "floatingFilter": True},
rowModelType="infinite",
dangerously_allow_code=True, # rend le HTML <a> des cellules liens
dashGridOptions={
"cacheBlockSize": 100,
"maxBlocksInCache": 10,
"rowBuffer": 0,
"infiniteInitialRowCount": 100,
"suppressCellFocus": True,
},
columnSize="responsiveSizeToFit",
style={"height": "70vh", "width": "100%"},
persistence=True,
persistence_type="local",
persisted_props=["filterModel", "columnState"],
)