Hey there i want to print the specific value of selected rows in python console.
I have created callback function. But when i select the row it do nothings
here is my layout code:
def dasher():
df = pd.read_csv('wyjebany.csv')
df = df[~df.HOME.str.contains('Beach|Futsal')]
df = df[~df.COUNTRY.str.contains('Germany Oberliga NOFV|France Youth U19
League|Portugal Champions NACIONAL Juniores A 1|Spanish Bizkaia-Tercera')]
df = df.replace(to_replace='Division|League|Liga|Footbal|Primavera', value='',
regex=True)
# df = df.replace(to_replace='.', value='', regex=True)
print(df)
print(df.columns)
app.layout = dash_table.DataTable(
columns=[{"name": i, "id": i} for i in df.columns],
row_selectable='multi',
sort_action='native',
# editable=True,
row_deletable=True,
# rows=[{}],
selected_rows=[],
css=[{'selector': 'tr:hover',
'rule': 'background-color: #80FF80',
# 'font-family': 'Times New Roman',
}],
html.Div(id='hidden-div', style={'display': 'none'},
),
here is my callback function
@app.callback(
dash.dependencies.Output('hidden-div', 'style'),
[dash.dependencies.Input('table', 'columns'),
dash.dependencies.Input('table', 'selected_rows')])
def print_value(columns,selected_rows):
print("Hi i am triggered")
# for i in selected_rows:
# print(i)
selected_rows = [columns[i] for i in selected_rows]
# selected_rows = pd.DataFrame(rows).iloc[i]
print(selected_rows)
style = {'display': 'none'}
return style