I wrote a function that has an app.callback that enables/disables a component. This function takes 4 arguments: output component, output component value, input component, input component.
def condition_checker(field_value):
'''Check if the value of a field is None. Return True if the field is None'''
if field_value is None:
return True
return False
def enable_disable(out_comp, out_comp_value, in_comp, in_comp_value):
'''The value pass to output is only True or False'''
@app.callback(Output(out_comp, out_comp_value), [Input(in_comp, in_comp_value)])
def enable_component(variable):
'''Out_comp is enabled when variable is not None'''
return condition_checker(in_comp_value)
If I were to call this function to enable or disable a component:
enable_disable('comp1', 'disabled', 'comp2', 'value')
This seems to not work but the callback graph in my app is correct. Has anyone tried this before?
Thanks