Masquage des colonnes et répercution dans le téléchargement closes #13
This commit is contained in:
+26
-5
@@ -10,17 +10,13 @@
|
||||
float: left;
|
||||
}
|
||||
|
||||
/* Masquer le bouton de configuration de la casse dans les filtres */
|
||||
input.dash-filter--case {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Réduire la taille du texte de la colonne Objet */
|
||||
|
||||
td[data-dash-column="objet"] {
|
||||
font-size: 85%;
|
||||
}
|
||||
|
||||
/* Couleur des en-têtes */
|
||||
.dash-table-container
|
||||
.dash-spreadsheet-container
|
||||
.dash-spreadsheet-inner
|
||||
@@ -40,6 +36,29 @@ td[data-dash-column="objet"] {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* Menu de masquage des colonnes */
|
||||
.column-header--hide svg {
|
||||
display: none;
|
||||
}
|
||||
.show-hide {
|
||||
position: relative;
|
||||
width: 180px;
|
||||
margin: 0 0 10px 10px;
|
||||
}
|
||||
|
||||
.show-hide::before {
|
||||
background: inherit;
|
||||
content: "Colonnes affichées";
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.show-hide-menu-item > input {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/* Alternance des couleurs pour les lignes */
|
||||
#table tr:nth-child(even) td {
|
||||
background-color: #feeeee;
|
||||
}
|
||||
@@ -49,6 +68,8 @@ td[data-dash-column="objet"] {
|
||||
margin: 0 0 20px 20px;
|
||||
}
|
||||
|
||||
/* Menu de navigation */
|
||||
|
||||
.navbar {
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
|
||||
+10
-5
@@ -66,15 +66,14 @@ datatable = dash_table.DataTable(
|
||||
"presentation": "markdown",
|
||||
"type": "text",
|
||||
"format": {"nully": "N/A"},
|
||||
"hideable": True,
|
||||
}
|
||||
for i in lf.collect_schema().names()
|
||||
],
|
||||
sort_action="custom",
|
||||
sort_mode="multi",
|
||||
sort_by=[],
|
||||
# export_format="xlsx",
|
||||
# export_columns="visible",
|
||||
# export_headers="ids",
|
||||
row_deletable=False,
|
||||
style_cell_conditional=[
|
||||
{
|
||||
"if": {"column_id": "objet"},
|
||||
@@ -220,11 +219,17 @@ def update_table(page_current, page_size, filter_query, sort_by, data_timestamp)
|
||||
@callback(
|
||||
Output("download-data", "data"),
|
||||
Input("btn-download-data", "n_clicks"),
|
||||
State("table", "hidden_columns"),
|
||||
prevent_initial_call=True,
|
||||
)
|
||||
def download_data(n_clicks):
|
||||
def download_data(n_clicks, hidden_columns):
|
||||
df_to_download = df_filtered.clone()
|
||||
|
||||
# Les colonnes masquées sont supprimées
|
||||
df_to_download = df_to_download.drop(hidden_columns)
|
||||
|
||||
def to_bytes(buffer):
|
||||
df_filtered.write_excel(buffer, worksheet="DECP")
|
||||
df_to_download.write_excel(buffer, worksheet="DECP")
|
||||
|
||||
date = datetime.now().strftime("%Y-%m-%d_%H:%M:%S")
|
||||
return dcc.send_bytes(to_bytes, filename=f"decp_{date}.xlsx")
|
||||
|
||||
Reference in New Issue
Block a user