I have a function which takes in a list and renders the content as a markdown in a callback. My problem is the function works the first time a date range is selected, a list of files that match the date range is displayed. However, picking a different date has no effect on the output. Is there something I am doing wrong or is there a better way to do this?
app.layout = html.Div(children=[
html.H4(children='Pick a range'),
dcc.DatePickerRange(
id='my-date-picker-range',
min_date_allowed=dt(1995, 1, 1),
max_date_allowed=dt(2030, 12, 30),
initial_visible_month=dt.now(),
with_portal=True,
display_format='Do MMM, YYYY',
),
html.Div(id='table-container',style={'color': 'red', 'border-style': 'outset'})
])
@app.callback(
dash.dependencies.Output('table-container', 'children'),
[dash.dependencies.Input('my-date-picker-range', 'start_date'),
dash.dependencies.Input('my-date-picker-range', 'end_date')])
def files_in_range(start_date, end_date, dt):
DT = []
s = 'advsot_'
e = '.xlsx'
if start_date is not None and end_date is not None:
start_date = convert_to_date(start_date)
end_date = convert_to_date(end_date)
for i in dt:
if start_date <= i <= end_date:
DT.append(s+'{:%Y%m%d}'.format(i)+e)
return dcc.Markdown(create_markdown(DT), id= 'table-container')