-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
DataTable: Custom Column Component #644
Comments
I am also looking to be able to do this. My use case is adding the “sortable” and “filter” props by default. |
I am also looking for this functionality. I am applying different filter types depending on the column data. I would like to create a CustomColumn component to handle the state and handlers for each filter. |
Hi, DataTable component expects Column tags in its children. After finding them, it creates itself according to their properties. When using a functional component, React doesn't tell us what type of component it is returning. Therefore, we cannot access the information of the returned element. For these reasons, DataTable cannot be created using functional components.
You can examine the example below to make dynamic columns; Also, please see this demo;
Best Regards, |
@mertsincan Is there a way to create dynamic columns with more advanced filters than the default search filter enabled by setting filter=true in the column? For example create a dropdown toggle filter (like the representatives filter in the docs) in a dynamically created column. I don't understand how to deal with the filter state (selectedOptions) and filterElement in this case. |
Current behavior
Now,
DataTable
Component can't receive react function componentok
ng
Expected behavior
DataTable
component can receive react function componentReact version:
16.5.2
PrimeReact version:
2.0.0-beta.9
Language: [all | TypeScript X.X | ES6/7 | ES5]
all
The text was updated successfully, but these errors were encountered: