Callback not Working With Html.Button and DataTable data

So basically, what I’m trying to do is this:

  1. Users Selects a Start TIME and End TIME to make changes to the datatable, which has of 80+ columns
    each representing 15minutes of a day.

  2. Once they select a Job Function and the StartTime and EndTime and then press the save_changes_button,
    a callback function runs and changes the value of the cells in those columns which range between the StartTime and EndTime with the job function they selected.

  3. So a usual flow would be to select say “Cashier”, then Select 15:00 to 18:00 as the time ranges. The function will change the cells who’s columns are “15:00”, “15:15”… etc. for that employee into “Cashier”.

the function currently looks like this, but when I simply put a print statement to check if the callbacks work, dash prints “ERROR LOADING DEPENDENCIES” into the app.

@app.callback(Output('indirect_job_changes', 'data'),            
               [Input('save_changes_button', 'n_clicks'),
               Input('main_datatable', 'data')]
             [State('indirect_job_options', 'value')
              State('start_time_filter', 'value'),
              State('end_time_filter', 'value')]
             )
def make_indirect_job_function_changes(n_clicks):
       print("hello")

How do I go about making this callback work? I want the callback to fire only when the save button is clicked, and it takes the current values in the JobFunction dropdown, and the StartTime,EndTime options which are of type dcc.Input(type = ‘time’).

@chriddyp any thoughts?

So I had a similar issue trying to debug a callback that I expected to work. In another post, that I can seem to find right now, the contributor suggested using Chrome and pressing F12 to view Dev tools. In my case, the rendering failure was clearly shown to be the ‘value’ property of a slider not being set. You might find success with F12 if you haven’t done so already.

2 Likes