Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ModularTable] Add unique row identifiers #444

Open
hatched opened this issue Apr 19, 2021 · 1 comment
Open

[ModularTable] Add unique row identifiers #444

hatched opened this issue Apr 19, 2021 · 1 comment
Labels
P3 Needs decision Needs team agreement in terms of triaging.

Comments

@hatched
Copy link
Contributor

hatched commented Apr 19, 2021

III  Action logs - Default view

After implementing the above it would be easier to test if we could select rows based on some criteria, a data-test prop so that we can isolate the 'parent' of grouped rows. It appears that to add such a feature we have to extend the getRowProps function.

Using a data driven approach as discussed in the previous issue we could add a prop to the row data that we would inspect to generate this value. There is already precedent for this with the useExpand plugin and `subRows.

A data object might look like...

const data = {
  application: "glance",
  operationID: "17 / openstack-upgrade",
  rowProps: {
    "data-test": "parent-row-glance",
  },
};

Another approach would be to allow a custom getRowProps function to be passed in as in the following examples. This allows for more flexibility but increases the API flexibility which we've previously discussed is undesirable at this time.

ex) https://github.com/tannerlinsley/react-table/blob/master/examples/data-driven-classes-and-styles/src/App.js
ex) https://jbetancur.github.io/react-data-table-component/?path=/story/conditional-styling--conditional-rows

@bartaz
Copy link
Member

bartaz commented Apr 19, 2021

TBH personally I prefer the getRowProps approach, seems more in line with what useTable tries to do. I think that data should contain just the data for the table, not config for the ModularTable component.

Defining a getRowProps function that returns set of custom props based on row data seems in line with how other useTable features are implemented.

@bartaz bartaz added the P3 Needs decision Needs team agreement in terms of triaging. label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Needs decision Needs team agreement in terms of triaging.
Projects
None yet
Development

No branches or pull requests

2 participants