primefaces / primefaces/primereact
TreeTable/Tree: filtering should use content of `TreeNode.data` (if defined)
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Defining a TreeNode for TreeTable (or Tree) as follows:
const userNode: TreeNode = {
key: user.id,
label: user.username,
data: {
name: (
<div>
<i className="pi pi-user pr-2"></i>
<span>{user.username}</span>
</div>
),
..
with column:
<Column field="name" header="" expander>
will render the Tree correctly. However, when having custom jsx in the data.name field, the TreeTable.globalFilter does not work anymore.
The filtering works when using a TreeNode without custom jsx:
const userNode: TreeNode = {
key: user.id,
label: user.username,
data: {
name: user.username,
..
Reproducer
No response
System Information
primereact 10.8.3
Steps to reproduce the behavior
- Setup a
TreeTable(orTree) with aTreeNodelike above - Add
globalFiltertoTreeTable(withstate-hook) and input field:
<InputText type="search" placeholder="Search" onChange={e => setGlobalFilter(e.target.value)} />
- Test the filter.
Expected behavior
The filtering should filter the content of TreeNode.data-fields.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TreeTable and Tree filtering entry points, focusing on globalFilter and how TreeNode.data values are read. Reproduce the issue with a data.name value containing JSX, then verify that filtering matches the rendered content while preserving the existing behavior for plain strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100