Hi Everyone! So I have a Dash Datatable that has initial data and the user has the ability to edit the data. However, I would like the user to be able to visibly see the cells that they have made changes to (ex. make the font color of the cells with the changed values red). Below is code for a sample Dash DataTable with editable columns. Any advice on how to go about applying that conditional formatting would be appreciated! Thanks in advance! (Also, while you’re here, if you have any suggestions on how to toggle a column’s editability with a button so that the user doesn’t have to worry about unintentional changes to the cells when looking at the DataTable, that would be appreciated as well!)
from dash import Dash, Input, Output, dash_table
import pandas as pd
import numpy as np
app = Dash(__name__)
def random_data():
df = pd.DataFrame(np.random.randint(0, 100, size=(10, 4)), columns=list("ABCD"))
return df.to_dict("records")
app.layout = dash_table.DataTable(
columns=[
{"name": column, "id": column, "editable": True, "type": "numeric"}
for column in list("ABCD")
],
data=random_data(),
id="sample-datatable",
)
if __name__ == "__main__":
app.run_server(debug=True)