hello Teachers!!
I’d like to make a button to add a row
when it already has many rows it takes so long
so I’m trying to use Patch…
Help me please…
!!
from dash import Dash, html, dcc, Input, Output,State, Patch, callback
app = Dash(__name__)
lst = [1] * 10000
app.layout = html.Div(
[
html.Button('add text ', id='btn'),
html.Div([html.H3(i) for i in lst[::-1]],id='output_div')
]
)
@callback(
Output("output_div", "children"),
Input("btn", "n_clicks"),
)
def add_rows(n_clicks):
p = Patch()
p.insert(0,{'props': {'children': n_clicks}, 'type': 'H3', 'namespace': 'dash_html_components'})
return p
if __name__ == "__main__":
app.run(debug=True)