Dash DataTable - limit number of rows that a user can select


I was wondering if there was any way for me to limit the number of rows a user can select from a data table?

Currently, I am generating a bar chart using rows that a user selects from a table. I can only accommodate 5 rows of data in my chart. I want the app to throw an error to the user and prevent him/her from selecting additional rows from the table so that I don’t overpopulate my graph.

I know that I can use a simple if/else function for my plot to stop it from overpopulating. However, this wouldn’t stop the user from being able to click other rows, which would look bad from a UI standpoint.

Is there any way for me to get around this?

1 Like

Has there been any update on this? I have been trying to do a similar thing but not sure how to do it since the row_selectable feature just allows us to take ‘single’ or ‘multi’ values. @chriddyp