There’s a way to set one callback from multiples ids?
Something like this …
@app.callback(
[Output('lista-de-datas', 'data'),
Output('lista-de-datas', 'value'),
Output('lista-de-datas', 'disabled'),
Input('lista-de-modelos', 'value')],
[Output('lista-de-datas2', 'data'),
Output('lista-de-datas2', 'value'),
Output('lista-de-datas2', 'disabled'),
Input('lista-de-modelos2', 'value')]
)
def choice_date(value):
.....
For now i’m using multiple callbacks to do the samething …
@app.callback(
Output('lista-de-datas', 'data'),
Output('lista-de-datas', 'value'),
Output('lista-de-datas', 'disabled'),
Input('lista-de-modelos', 'value')
)
def choice_date(value):
if 'MERGE' not in value:
dirs = os.listdir(f'{FTP_PREFIX}/{value.lower()}')
dirs = [pd.to_datetime(x, format='%Y%m%d%H') for x in dirs]
dirs = sorted(dirs, reverse=True)
dirs = [x.strftime('%d/%m/%Y %H UTC') for x in dirs]
dirs = [{'value': x, 'label': x} for x in dirs]
return dirs, dirs[0]['value'], False
else:
ini = ['-']
variavel = 'Precipitação acumulada em 24 hr'
return ini, variavel, True
#######################################################################################
@app.callback(
Output('lista-de-datas2', 'data'),
Output('lista-de-datas2', 'value'),
Output('lista-de-datas2', 'disabled'),
Input('lista-de-modelos2', 'value')
)
def choice_date(value):
if 'MERGE' not in value:
dirs = os.listdir(f'{FTP_PREFIX}/{value.lower()}')
dirs = [pd.to_datetime(x, format='%Y%m%d%H') for x in dirs]
dirs = sorted(dirs, reverse=True)
dirs = [x.strftime('%d/%m/%Y %H UTC') for x in dirs]
dirs = [{'value': x, 'label': x} for x in dirs]
return dirs, dirs[0]['value'], False
else:
ini = ['-']
variavel = 'Precipitação acumulada em 24 hr'
return ini, variavel, True