plotly / dash-table-experiments

NO LONGER SUPPORTED - use https://github.com/plotly/dash-table instead
MIT License
174 stars 57 forks source link

Feature Request: Radio Selector instead of Checkbox Selector #15

Closed josesho closed 5 years ago

josesho commented 6 years ago

Hi Chris and Dash team,

Just wondering if there are plans to create a radio-selector table (ie, only one row may be selected at any time) vs the current checkbox-style selection (multiple rows at any time if selectable = True.

If not, I'm a little stumped in using callback logic to force the selected_row_indices property to 'pop' any selected rows and to only take on the last selected row value.

Appreciate any thoughts or help! Thanks.

chriddyp commented 6 years ago

This is a great idea. A couple folks brought this up in the community forum: https://community.plot.ly/t/dash-datatable-distinguishing-between-single-row-select-and-multi-row-select/6093/6, but let's track the issue here.

AFAIK, this isn't possible right now. I believe that the last item in the selected_row_indices (selected_row_indices[-1]) should be the last selected row, but I can't say for certain.

Here is the issue in the associated issue in the underlying data grid: https://github.com/adazzle/react-data-grid/issues/908


If any company out there would like to sponsor this feature, please reach out

josesho commented 6 years ago

Yes @chriddyp , In my own poking around, it is possible to grab the data from the last selected row easily (but using selected_row_indices[0] instead?). It seems like this is restricted by the underlying React table's defaults?

Thanks! J.

josesho commented 6 years ago

conversely, is there a way to pull the rowdata simply by clicking of the row itself? (can't seem to find any docs in the react-data-grid to suggest that one could)

shimwell commented 6 years ago

The check boxes are great and radio buttons sound like a nice addition. I guess it won't make any sense to include the check all option at the top of the column when working with radio buttons. Perhaps this could be a feature to show or hide the upper most checkbox / radio button

doccray commented 6 years ago

Hi All, there is a workaround to implement single selections with the row_selectable feature. This is not optimal because there is still the checkbox in the header row but maybe it is useful for somebody.

peek 2018-05-01 16-06

Here are the changes: https://github.com/doccray/dash-table-experiments/commit/8e2bba57b17074f4ee08d1e27b30b798d9b72ca8

@chriddyp Is this worth a pull request?

shimwell commented 6 years ago

That looks most useful to me 😀. I would like to use this feature on a dash webapp I am making. I create the experimental table dynamicaly and sometimes it can be large enough that the select all check box slows down the app. https://9md3uimove.execute-api.us-east-1.amazonaws.com/dev/mydash

josesho commented 6 years ago

Looks great! Upvote for PR!

On Wed, 2 May 2018 at 02:32, Jonathan Shimwell notifications@github.com wrote:

That looks most useful to me 😀. I would like to use this feature on a dash webapp I am making. I create the experimental table dynamicaly and sometimes it can be large enough that the select all check box slows down the app. https://9md3uimove.execute-api.us-east-1.amazonaws.com/dev/mydash

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/plotly/dash-table-experiments/issues/15#issuecomment-385750279, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPoBfUvIFnWOgOhjurv6zUigWQB6Ccyks5tuKpSgaJpZM4QSCFw .

slash31 commented 6 years ago

Yes, PR, please. @chriddyp @doccray

chriddyp commented 6 years ago

@chriddyp Is this worth a pull request?

Yup! I'm 👍 with those changes

ndmurray commented 6 years ago

This looks great, although I'm trying to implement by importing DataTable.react.js in addition to the original bundle.js file for dash_table_experiments to no avail. Do you have any advice on how to implement this new DataTable.react.js file?

rquintino commented 6 years ago

hi all? just to check any update on the feature or release? would be very useful thx!

rquintino commented 6 years ago

just adding, wasn't clear if this will be possible with the PR, would be useful to separate current selection (checkboxed based) from current row clicked/highlighted (click on any cell in the row).

Main scenario is reacting every time I click anywhere on a row , ex: see detail layout on right. A scenario I use a lot in R shiny. thx!

heonjushin commented 6 years ago

Is there any schedule to release this feature? I'm really looking forward to it :)

ZsofiaHa3 commented 5 years ago

Any updates on this?

alexcjohnson commented 5 years ago

This package is obsolete and about to be archived. The current package dash-table has this option, row_selectable='single' https://dash.plot.ly/datatable/interactivity