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

Row ID Support [Sponsored: Due March 1] #312

Closed
chriddyp opened this issue Dec 19, 2018 · 3 comments · Fixed by #412
Closed

Row ID Support [Sponsored: Due March 1] #312

chriddyp opened this issue Dec 19, 2018 · 3 comments · Fixed by #412
Labels
dash-meta-sponsored Development that has been sponsored by an organization https://plot.ly/products/consulting-and-oem/

Comments

@chriddyp
Copy link
Member

Several properties provide features on a per-cell basis (per-cell dropdowns, per-cell tooltips, per-cell borders). Data in the table is provided through a data property and this property only contains row indices, column IDs, and the value of that cell for that particular row index and column ID.

The row indices aren’t fixed: data can be filtered (rows removed) or sorted (rows re-ordered) or updated via the backend, and the mapping between these properties and the data can become ambiguous.
To circumvent this, the DataTable needs a concept of “row IDs”, similar to the “column IDs” that currently exist. These IDs would be supplied by the dash developer and would not affect the order of the rows. It would be similar to a “hidden column”.

@chriddyp chriddyp added the dash-meta-sponsored Development that has been sponsored by an organization https://plot.ly/products/consulting-and-oem/ label Dec 19, 2018
@chriddyp chriddyp modified the milestone: Feb 1 Dec 19, 2018
@chriddyp chriddyp changed the title dash-table - Row ID Support [Sponsored: Due March 1] Row ID Support [Sponsored: Due March 1] Dec 19, 2018
@alexcjohnson
Copy link
Collaborator

One bit of API for this I'd like input on: how should active_cell be handled? (And selected_cells, but that will follow from active) Currently active_cell is an array [row_index, column_index]. If we're adding row IDs to this it seems natural to add column IDs as well.

  • Option 1: add a new active_cell_id prop, as an array [row_id, column_id]
  • Option 2: change active_cell to an object `{row: 4, column: 2, row_id: 'asparagus', column_id: 'calories'}

Aside from that I'm simply planning to allow users to add id to each row of data, and if there's no column with id='id' it will be an automatic hidden column, but you could also choose to display it by making such a column. And in addition to whatever we decide about active_cell and selected_cells, I'll add a new prop selected_row_ids to complement selected_rows.

@chriddyp
Copy link
Member Author

Hm, I don't think I have a strong preference either way. I think I prefer Option 2 since it keeps the API smaller & is "self-documenting".

Beyond these two new properties, should/could there be a read-only/derived property that just returns the visible row IDs? So, if you do a front-end filter, you could listen to derived_virtual_row_ids and get back just the row IDs rather than all of the columns? See this example: https://dash.plot.ly/datatable/interactivity

@alexcjohnson
Copy link
Collaborator

alexcjohnson commented Apr 15, 2019

Ah yes, good idea, but I'd call it derived_viewport_row_ids. NVM, I didn't understand virtual vs viewport - #412 has both and more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dash-meta-sponsored Development that has been sponsored by an organization https://plot.ly/products/consulting-and-oem/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants