I am building an app that shows some tables with Icons. Actually i am fetching csv files with values:
Task Name,Main Concept,Solutions,Duration,Difficulty,Priority
Ueb01,Variables,2,20,5,4
For the Difficulty value i have choosen the fire icon. This works for initial rendering:
df_tasks['Difficulty'] = df_tasks['Difficulty'].apply(lambda x:
'🔥🔥🔥🔥🔥' if x == 5 else (
'🔥🔥🔥🔥' if x == 4 else (
'🔥🔥🔥' if x == 3 else (
'🔥🔥' if x == 2 else (
'🔥' if x == 1 else ''
)))))
I can also add new rows with the variable:
emptyTaskRow = {'Task Name': '','Main Concept': '','Solutions': 0,'Duration': 0, 'Difficulty': '🔥','Priority': 1}
@app.callback(
Output('table-tasks', 'data'),
[Input('editing-taskrows-button', 'n_clicks')],
[State('table-tasks', 'data'),
State('table-tasks', 'columns')])
def add_row(n_clicks, rows, columns):
if n_clicks > 0:
rows.append(emptyTaskRow)
return rows
My problem actually is, i need to manipulate the table e.g. typing a 3 into a cell -> and three Fire Icons appears.
style_data_conditional works well for background color, if you want to have a heatmap-like table.
But how to solve this with Icons?