primefaces / primefaces/primereact

DataTable: backward compatibility for function as field/filterfield no longer provided

Open
#2,622 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Status: Discussion
Dominant language
CSS
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

There is no guarantee in receiving an immediate response in GitHub Issue Tracker, If you'd like to secure our response, you may consider PrimeReact PRO Support where support is provided within 4 business hours

I'm submitting a ... (check one with "x")

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Codesandbox Case (Bug Reports)

https://codesandbox.io/s/primereact-test-forked-z46k20

Current behavior
The Datatable no longer supports the ability to hand over functions as field or filterfield for columns. Even though the typescript interface for Column didn't mention it officially, up to version 6.6 of PrimeReact it was possible to also hand over functions instead of strings for the field/filterfield. This hidden feature allowed to handle dynamic table data where not all columns have the same structure, maybe for example arrays as properties with different length, where the values assigned to a column of the Datatable have different indexes in the arrays of the different row's Data. As of version 7.0 functions handed over as field/filterfield are internally converted to strings to use them as keys for the filters-array.
Also up to version 6.6 the rowData was handed over to the custom filter function which is no longer supported in later versions, so its also not possible to use the custom filter function to determine the individual value of the column while filtering.

Expected behavior
The ability for use of functions should be supported as before, otherwise its not possible to update to newer versions of PrimeReact which should be possible because of bugfixes of later versions.

Minimal reproduction of the problem with instructions
See the codesandbox example. Its build with PrimeReact 6.6.0. When it is changed to 7.2.0 of PrimeReact it no longer works.

Please tell us about your environment:

  • React version:
    17.0.2

  • PrimeReact version:
    7.0 - 7.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    all

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the DataTable Column field/filterField handling and filtering behavior described in the issue, using the linked CodeSandbox and the PrimeReact 6.6.0 versus 7.2.0 comparison as the reproduction. Confirm that function-valued fields and rowData-dependent custom filters work as expected in the newer version.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.