Classe partagée pour la génération de datatables #56

This commit is contained in:
Colin Maudry
2025-11-15 21:08:28 +01:00
parent 503ec33f43
commit 6b133c21ab
+6 -23
View File
@@ -1,5 +1,6 @@
from dash import Input, Output, callback, dash_table, dcc, html, register_page from dash import Input, Output, callback, dcc, html, register_page
from src.figures import DataTable
from src.utils import ( from src.utils import (
df_acheteurs, df_acheteurs,
df_titulaires, df_titulaires,
@@ -73,31 +74,13 @@ def update_search_results(query):
className=f"results_{org_type}", className=f"results_{org_type}",
children=[ children=[
html.H3(f"{org_type.title()}s : {count}"), html.H3(f"{org_type.title()}s : {count}"),
dash_table.DataTable( DataTable(
dtid=f"results_{org_type}_datatable",
columns=columns, columns=columns,
data=results.to_dicts(), data=results.to_dicts(),
page_size=10, page_size=10,
# style_table={"overflowX": "auto"}, sort_action="none",
markdown_options={"html": True}, filter_action="none",
cell_selectable=False,
style_cell_conditional=[
{
"if": {"column_id": "acheteur_nom"},
"maxWidth": "250px",
"textAlign": "left",
"overflow": "hidden",
"lineHeight": "18px",
"whiteSpace": "normal",
},
{
"if": {"column_id": "titulaire_nom"},
"maxWidth": "250px",
"textAlign": "left",
"overflow": "hidden",
"lineHeight": "18px",
"whiteSpace": "normal",
},
],
), ),
], ],
) )