我需要帮助!!! 我已经填写了一份报名表,您必须输入已完成的日常基础工作。 我有一个破折号数据表,该表已经具有员工要完成的日常工作数据。 一旦员工完成工作,他或她将在输入表单中输入数据,而我的数据表将预测该工作的下一个日期。 预测部分运行正常。 唯一的事情是,当我从数据中添加一个条目时,它应该通过任何方式同时在我的仪表板中更新。 到目前为止,我只能想到一个通过破折号表格进行更新的按钮。 公开征求意见。
答案 0 :(得分:1)
一种实现此目的的方法是编写一个回调,以根据输入表单值的更改来更新表。该示例可以调整为生成表(Dash basic callback help)
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div([
dcc.Input(id='my-id', value='initial value', type='text'),
html.Div(id='my-div')
])
@app.callback(
Output(component_id='my-div', component_property='children'),
[Input(component_id='my-id', component_property='value')]
)
def update_output_div(input_value):
return 'You\'ve entered "{}"'.format(input_value)
if __name__ == '__main__':
app.run_server(debug=True)