Filtering DataTable using input from another DataTable

I have two dataframes/datatables.
df_1 is summary
df_2 is detail

Both are shown as datatable on the app.

**df_1**
id      time    type     flag    pass_count  fail_cout   fail_rate_%
1       t1       a         false
1       t1       b         true              1            1           50             <-- row_2         
1       t1       c         true              2                        0                        
1       t2       d         false
1       t2       e         true              4            2           50             <-- row_5      
1       t2       f          true             4            3           75             <-- row_6
2       t1        
...
...
n
**df_2**
id      time    type     pass/1_fail/0_flag    value .... n_column 
1       t1       a       
1       t1       b              0                ad                  
1       t1       b              1                er
1       t1       c              1                vc         
1       t1       c              1                za                  
1       t2       d       
1       t2       e              0                sa
1       t2       e              1                sd
1       t2       e              1                aw
1       t2       e              0                rw                              
1       t2       f              0                lk  
1       t2       f              0                ui     
1       t2       f              0                oj     
1       t2       f              0                nh     
1       t2       f              1                mk                               
2       t1   
...
...
n

When clicked on df_1 row that has fail_rate_% value,
df_2 is filtered where id, time, type is same. Because this is showing failures only, I will add another condition To get the failures only

The filter on df_2 would be
df_2[(df_2['id'] == id) & (df_2[time] == time) & (df_2[type] == type) & (df_2['pass/1_fail/0_flag'] == 0)]

Example:

when cliced on row_2, df_2 returns

id      time    type     pass/1_fail/0_flag    value  .... n_column  
1       t1        b               0            ad           ..... 

when cliced on row_5, df_2 returns

id      time    type     pass/1_fail/0_flag    value .... n_column  
1       t2         e               0            sa           ..... 
1       t2         e               0            rw           ..... 

when cliced on row_6, df_2 returns
id      time    type     pass/1_fail/0_flag    value .... n_column  
1       t2       f               0             ui           .....    
1       t2       f               0             oj           .....     
1       t2       f               0             nh          .....

Help Needed

But I don’t know who to write the callback.
I need help with callback and how to get the selected row column names + variables inside the function to do the filter.

I think output would be as follow?
But not sure about input and how to use the selected column+variables inside the function to filter on.

@app.callback(
    [
        Output(component_id='df_2', component_property='data'),
        Output(component_id='df_2', component_property='columns')
    ],
    [
        Input(component_id='df_1', component_property='data'),
        Input(component_id='df_1', component_property='columns')
    ]
def update_df_2(...): 
    # how to use column names and values from df_1
    # filter using above logic and return

Update

I was able to get to the next steps using this code.

@app.callback(
    [
        Output(component_id='df_2', component_property='data'),
        Output(component_id='df_2', component_property='columns')
    ],
    [
        Input(component_id='df_1', component_property='data'),
        Input(component_id='df_1', component_property='selected_rows')
    ]
def update_df_2(...):
        # get the selected row from the df_1
        tmp_lst = pd.DataFrame(data).iloc[row].to_dict('records')
        # convert it to dictionary so I can get values 
        filter_dict = dict(chain.from_iterable(map(methodcaller('items'), tmp_lst)))
        # read df_2 from file.
        # filtered the df and returned data and columns

But, now I am running into this issue.
This call back should only execute when I clicked on a cell in df_1, but it looks like it’s throwing an error.

How do I make sure that call back function only runs when clicked on row in df_1?