gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Entire Row Data in Dataframe Select Event

Open derek-pyne opened this issue 1 year ago • 2 comments

  • [x] I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.
I have a Dataframe Component with a row for every datapoint and multiple columns with aspects of the data.... one of the columns being an ID column.

I have my app instrumented such that when someone clicks a row in the Dataframe, several other components are updated to showcase data for that particular ID.

However, the evt send when a Dataframe is selected only contains the value and index of the cell that was clicked. If someone has clicked a cell in the ID column.... this works great. But if they clicked a different cell in the row I have no way of figuring out what ID that corresponds to from the evt.

The index value in the event is not useful as it gives the current index of wherever the user clicked... and does not take into account any column sorting the user may have done (ie. if you click the first row and first column.. the index will always return [0,0] even if you have sorted the columns such that the 100th row is now shown in the first row spot).

Describe the solution you'd like
Either:

  • Entire row sent with dataframe select along with everything else
  • An index that references the underlying data regardless of sorting
  • A way to get the current view of the Dataframe so that I can deduce what row a particular index refers to... this might exist but struggling

derek-pyne avatar Jan 23 '24 21:01 derek-pyne

You can kind of make this happen in gr.Dataset, but it's not as pretty

jonnyjohnson1 avatar Feb 13 '24 05:02 jonnyjohnson1

I have exact same issue and feature requirement here. Any progress on this one?

wangyiav avatar Jun 26 '24 11:06 wangyiav

Same here - would be great to know the row index of what the user clicked in the original data.

skye0402 avatar Aug 06 '24 10:08 skye0402

Working on a PR that should provide a solution for this: https://github.com/gradio-app/gradio/pull/9128 if anyone would like to give feedback (installation instructions are in the PR)

abidlabs avatar Aug 15 '24 23:08 abidlabs