How to Print Value of Selected Row to Console

Hi there!

I have a row of customer data in a dash datatable. Upon selecting a row, I want to print the customer’s phone number to console. I’ve gotten as far as accessing the selected_row property, but I’m not sure what to do with it.

Any advice?

Relevant code:

  html.Div([
        html.H3(children= ['7 Day Expected Purchases: ', total_repeat_purchases]),
        dash_table.DataTable(
        id = 'customer-summary',
           data= dff.to_dict('records'),
           columns=[{'name': i, 'id': i} for i in dff.columns],
           page_size = 10,
           row_selectable = 'single',
           selected_rows = [],
           selected_row_ids = []
        ),
        html.Button(id = 'submit-button-state', n_clicks=0, children='Submit'),
        html.Div(id='output-state')
    ])
@app.callback(
    Output('output-state', 'style'),
    [Input('submit-button-state', 'n_clicks')],
[State('customer-summary', 'selected_rows')]
)

def print_rows(selected_rows, n_clicks):
    print(selected_rows, ' ', n_clicks)
    style = {'display': 'none'}
    return style

Example Row

Cust_ID Phone_number
1000 555-555-5555