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

Filtering and Search in Datagrid with nested rows is not working as expected #4652

Closed
Sreejith-Websphere opened this issue Mar 30, 2024 · 9 comments · Fixed by #5501
Closed
Assignees
Labels
component: Datagrid role: dev Sev 2 Aspects of design is broken and impedes users in a significant way, but has workaround. status: needs triage 🕵️‍♀️ type: bug 🐛 Something isn't working

Comments

@Sreejith-Websphere
Copy link

Sreejith-Websphere commented Mar 30, 2024

If we apply filter in datagrid, its not filtering from nested rows (but sorting and pagination works)
used useFiltering hook, (tested in chrome)

when we click clear filter also its not listing all data back from nested rows

search also not fetching data from nested rows
Screenshot 2024-04-05 at 12 59 03 PM
Screenshot 2024-04-05 at 12 59 12 PM

@github-project-automation github-project-automation bot moved this to Needs triage 🧐 in Carbon for IBM Products Mar 30, 2024
@Sreejith-Websphere Sreejith-Websphere changed the title Filtering in Datagrid with nested rows is not working as expected Filtering and Search in Datagrid with nested rows is not working as expected Apr 1, 2024
@lee-chase
Copy link
Member

Hi @matthewgallo @elycheea

Any chance this is possible without having to upgrade to V8 of react-table?

That said it is a slightly weird way to filter a row that has success, but child that failed.

@rcsatheeshkumar
Copy link

rcsatheeshkumar commented May 8, 2024

We are using data-grid in IBM product and we are facing a similar issue in search with data-grid with nested rows. If a row is shown in search result and search value gets cleared, then only the parent row gets restored but the nested rows are not restored. It could be reproduced in the storybook itself(https://ibm-products.carbondesignsystem.com/?path=/story/ibm-products-components-datagrid-nestedrows--nested-rows-usage-story) as shown below,

https://github.com/carbon-design-system/ibm-products/assets/17987392/e20db41d-575e-4f2a-91f5-75bdba838d80.

I believe, it will get fixed once the issue posted by Original Poster gets fixed. So, could some one please let me know about the ETA for providing a fix for this issue ?

@elycheea
Copy link
Contributor

@elycheea elycheea added type: bug 🐛 Something isn't working Sev 2 Aspects of design is broken and impedes users in a significant way, but has workaround. and removed status: needs triage 🕵️‍♀️ status: needs reproduction labels May 13, 2024
@elycheea elycheea moved this from Needs triage 🧐 to Backlog 🌋 in Carbon for IBM Products May 13, 2024
@rcsatheeshkumar
Copy link

Hi Team,
This issue is blocking our QA tasks, could you please share the ETA for this fix and expedite the fix please. Thanks.

@matthewgallo
Copy link
Member

matthewgallo commented Jun 13, 2024

Unfortunately this stems from the version (v7.x.x) of react-table that we are using and this bug will not be fixed in that library unless we upgrade react-table which is not planned right now.

A workaround does exist however, by adding a getSubRows property to the useDatagrid hook. We'll update our storybook with the following workaround as well.

const NestedRows = () => {
  const columns = React.useMemo(() => defaultHeader, []);
  const [data] = useState([]); // data
  const datagridState = useDatagrid(
    {
      columns,
      data,
      DatagridActions,
      getSubRows: (row) => row.subRows, // adding this property makes the subRows visible again after search/global filter is removed
    },
    useNestedRows
  );

  return <Datagrid datagridState={datagridState} />;
};

@rcsatheeshkumar
Copy link

@matthewgallo is there a workaround to make the search consider the nested rows content as welll ?

@Xirax
Copy link

Xirax commented Aug 9, 2024

I'm attaching a video with most recent behavior which is not fully correct (We can't search for nested rows):

TEST.mov

@RichKummer
Copy link

Hey @Xirax , could you please open a new issue for the missing behavior? Thank you!

@matthewgallo
Copy link
Member

If issue still exists, we can use the new issue for any missing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Datagrid role: dev Sev 2 Aspects of design is broken and impedes users in a significant way, but has workaround. status: needs triage 🕵️‍♀️ type: bug 🐛 Something isn't working
Projects
Archived in project
8 participants