Hi,
Since the recent update to the shiny framework where the row_selection_mode='multiple' argument in render.DataGrid became selection_mode = 'rows', the input._selected_rows() function also stopped working. Is there a new substitute for this?
The DataGrid documentation still states this syntax, but it doesnt work. The code is as follows:
@reactive.Effect
@reactive.event(input.delete_row)
def delete_row():
selected_indeces = list(input.dynamic_input_selected_rows())
#print(selected_indeces)
if len(samples_df) > 0:
#get all indeces in the database_df dataframe
all_indeces = list(database_df.index)
#remove selected indeces not in all_indeces
selected_indeces = [index for index in selected_indeces if index in all_indeces]
#drop the selected rows from the samples_df and database_df
samples_df.drop(index = selected_indeces, inplace=True)
database_df.drop(index = selected_indeces, inplace=True)
file_paths.drop(index = selected_indeces, inplace=True)
file_paths.reset_index(drop=True, inplace=True)
samples_df.reset_index(drop=True, inplace=True)
database_df.reset_index(drop=True, inplace=True)
else:
ui.notification_show("You have exterminated all the rows")
@output
@render.data_frame
def dynamic_input():
if len(samples_df) > 0:
return render.DataGrid(samples_df, selection_mode="rows")
else:
ui.markdown("No data added")
Any help would be much appreciated