Skip to content

Conversation

@dominik-petrik
Copy link
Contributor

What: Closes #8976

I have also revamped the demo to use functional instead of class component.

@patternfly-build
Copy link
Contributor

patternfly-build commented Apr 21, 2023

};
});
const setServerExpanded = (server, isExpanding) => {
const otherExpandedServerNames = expandedServerNames.filter((r) => r !== server.name);
Copy link
Contributor

@gitdallas gitdallas Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have a setAreAllExpanded here (or in an effect that looks at expandedServerNames) as toggling a single thing could affect that

@dominik-petrik dominik-petrik force-pushed the table-expandCollapseAll-cleanup branch from bf7d11b to 4689149 Compare April 27, 2023 14:35
@nicolethoen nicolethoen self-requested a review May 3, 2023 20:40
Copy link
Contributor

@nicolethoen nicolethoen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also seeing the codesandbox throw an error about the onPageResize not being defined for the dashboardwrapper. i'm also seeing the same issue in other demos in the codesandbox, though so that can be addressed in the future.

@@ -1,28 +1,19 @@
import React from 'react';
import { Card, Label, PageSection } from '@patternfly/react-core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you combine the react-core imports and make sure that Text and TextContent are also added?

@@ -1,28 +1,19 @@
import React from 'react';
import { Card, Label, PageSection } from '@patternfly/react-core';
import { expandable } from '@patternfly/react-table';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unused import of expandable

const setServerExpanded = (server, isExpanding) => {
const otherExpandedServerNames = expandedServerNames.filter((r) => r !== server.name);
setExpandedServerNames(isExpanding ? [...otherExpandedServerNames, server.name] : otherExpandedServerNames);
setAreAllExpanded(expandedServerNames.length == serverData.length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use '===' rather than just '==' here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding onto this, can we also check whether the expandedServerNames length becomes 0? Currently if you expand a row and then collapse it such that there are no expanded rows, the overall "all expanded" carat isn't updating.

@nicolethoen nicolethoen force-pushed the table-expandCollapseAll-cleanup branch from 4689149 to deddb1d Compare May 16, 2023 21:05
Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The state properly updates when a single folder collapse that results in all folders being collapsed updates the bulk select carat, but seeing a bug where expanding/collapsing a second folder is also toggling the bulk select.

@gitdallas
Copy link
Contributor

@kmcfaul - ah that's interesting. i do notice that it is using the state immediately after setting it. it should use the data that is being used to set the state instead of the state itself... or better yet - an effect.

@dominik-petrik

@gitdallas gitdallas self-assigned this May 18, 2023
@gitdallas gitdallas requested a review from kmcfaul May 18, 2023 18:16
Copy link
Contributor

@kmcfaul kmcfaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want the bulk select carat to show as "expanded" when some of the folders are expanded? Right now it's only showing "expanded" when all of the folders are open.

If so then it looks good to me

@nicolethoen
Copy link
Contributor

I think that top carat mean's expand all - so it should be open only when all are expanded?

@nicolethoen nicolethoen merged commit 419163c into patternfly:v5 May 23, 2023
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-docs@6.0.0-alpha.124
  • @patternfly/react-table@5.0.0-alpha.118

Thanks for your contribution! 🎉

nicolethoen added a commit to Kells512/patternfly-react that referenced this pull request Sep 1, 2023
* fix(Table) clean up 'Expand collapse all' demo

* update allExpanded on single row toggle

* address outstanding comments

* refactor collapse/expand all using effect

---------

Co-authored-by: nicolethoen <nthoen@redhat.com>
Co-authored-by: gitdallas <dallas.nicol@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table - clean up 'Expand collapse all' demo

5 participants