span down columns for size
This commit is contained in:
@@ -24,8 +24,14 @@ def format_string(col, condition):
|
||||
return "{" + col["id"] + "}" + f" {condition}"
|
||||
|
||||
|
||||
def column_formats(col):
|
||||
def column_formats(col, pct):
|
||||
return [
|
||||
{
|
||||
"if": {"column_id": col["id"]},
|
||||
"maxWidth": f"{pct}%",
|
||||
"width": f"{pct}%",
|
||||
"minWidth": f"{pct}%",
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"column_id": col["id"],
|
||||
@@ -69,8 +75,9 @@ def table_rows(score_list):
|
||||
|
||||
|
||||
def column_formatting(hole_columns):
|
||||
pct = round((100 - (10 + 5)) / len(hole_columns), 2)
|
||||
return [
|
||||
entry
|
||||
for format_list in [column_formats(hole) for hole in hole_columns]
|
||||
for format_list in [column_formats(hole, pct) for hole in hole_columns]
|
||||
for entry in format_list
|
||||
]
|
||||
|
||||
@@ -80,7 +80,20 @@ def get_scores():
|
||||
|
||||
color_formatting = wordlinator.utils.web.column_formatting(hole_columns)
|
||||
formatting = [
|
||||
{"if": {"column_id": "Name"}, "textAlign": "center"},
|
||||
{
|
||||
"if": {"column_id": "Name"},
|
||||
"textAlign": "center",
|
||||
"width": "10%",
|
||||
"maxWidth": "10%",
|
||||
"minWidth": "10%",
|
||||
},
|
||||
{
|
||||
"if": {"column_id": "Score"},
|
||||
"textAlign": "center",
|
||||
"width": "5%",
|
||||
"maxWidth": "5%",
|
||||
"minWidth": "5%",
|
||||
},
|
||||
*color_formatting,
|
||||
]
|
||||
return dash.dash_table.DataTable(
|
||||
|
||||
Reference in New Issue
Block a user