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

fix(tree): toggle node when filtering mode #7282

Merged
merged 6 commits into from
Jan 3, 2025

Conversation

KumJungMin
Copy link
Contributor

@KumJungMin KumJungMin commented Oct 1, 2024

Defect Fixes

How To Resolve

Issue

  • When filtering in the tree, the toggle function doesn't work.
  • Upon investigation, it was found that previously, when filtering, we used node.expanded = true to expand nodes.
  • In this case, the child component would recognize the node.expanded value based on specific conditions and expand the node.
  • However, in this approach, when filtering, the toggle event argument is an empty object
  • Therefore, the toggle function does not work while filtering.

Solution

  • I added filterExpandedKeys to be used when filtering and ensured that this value is used during filtering.
  • When a toggle is requested, I update filterExpandedKeys while filtering, and in other cases, I update expandedKeysState.
if (isFiltering) {
    setFilterExpandedKeys(value);
} else {
    setExpandedKeysState(value);
}

Result

Test Cases:

  1. When filtering, the corresponding node should be expanded.
  2. It should be possible to toggle nodes while in a filtering state.
  3. If a node was toggled before filtering, it should remain expanded after filtering is finished.
2024-10-01.2.54.29.mp4

Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 3:40pm
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Jan 3, 2025 3:40pm

@melloware melloware requested a review from mertsincan October 1, 2024 12:03
@melloware melloware added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Oct 1, 2024
@melloware melloware merged commit e921655 into primefaces:master Jan 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Pending Review Issue or pull request is being reviewed by Core Team
Projects
None yet
3 participants