Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Add derived properties derived_virtual_selected_rows and derived_viewport_selected_rows #147

Closed
chriddyp opened this issue Oct 22, 2018 · 6 comments
Assignees
Labels
dash-type-enhancement New feature or request

Comments

@chriddyp
Copy link
Member

chriddyp commented Oct 22, 2018

selected_rows doesn't update on sort or filter

See this example: https://github.com/plotly/dash-docs/pull/232/files#diff-61a5d030fd2c372f3abe94110f039e85

@Marc-Andre-Rivet Marc-Andre-Rivet self-assigned this Oct 22, 2018
@Marc-Andre-Rivet
Copy link
Contributor

Marc-Andre-Rivet commented Oct 22, 2018

@chriddyp I think what you are experiencing is the intended behavior. The current implementation maps the selected_rows to the actual row index in the dataframe, not in the viewport. Filtering and sorting will have no impact on selected_rows just like filtering/sorting has no impact on the underlying df. Would you be interested in knowing the viewport rows that are selected?

@chriddyp
Copy link
Member Author

Would you be interested in knowing the viewport rows that are selected?

Yes. And not just the page, but selected rows for the entire dataset.

@Marc-Andre-Rivet
Copy link
Contributor

Ok. We could have derived selected_rows similar to the derived virtual and viewport data. e.g derived_virtual_selected_rows and derived_viewport_selected_rows that would contain an array of indices filtered/sorted for virtual and filtered/sorted/paged for viewport. Like the derived data these would be purely read-only.

@chriddyp
Copy link
Member Author

Like the derived data these would be purely read-only.

Users will also want to set these programatically, so there should be some version that is write-able. Ideally, they are the same property so that users can write in one callback and then read in a chained callback.

@chriddyp
Copy link
Member Author

This is how the existing prototype works: https://github.com/plotly/dash-table-experiments/blob/master/usage.py#L64

@Marc-Andre-Rivet
Copy link
Contributor

selected_rows is writeable -- do you mean to say we would need a way to set the selection through the derived ones?

@Marc-Andre-Rivet Marc-Andre-Rivet changed the title selected_rows doesn't update on sort or filter Add derived properties derived_virtual_selected_rows and derived_viewport_selected_rows Nov 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dash-type-enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants