-
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
Row component does not receive className and style property #7329
Comments
@Nickog13 any analysis or PR would be great. I have a feeling the issue is somewhere merging the PassThrough props with the row props. |
I think the issue is, the row props are not applied to the rows in components like datatable\TableFooter, datatable\TableHeader and the corresponding treetable components. For example in TableFooter.js there is createContent with that (in rows.map()):
Are the style and className property supposed to be included in getRowPTOptions(row, 'root')? I was able to fix it and include the className by using the RowBase.getProps() just like it is done in row\Row.js but I am unsure whether this is the correct way to fix it or to adjust getRowPTOptions:
Also I am not sure at which points I need to fix this additionally, I guess TableFooter.js, TableHeader.js, TreeTableFooter.js, TreeTableHeader.js, but I am not sure if there are other components, at which needs to be fixed as well. |
Hmm the |
I have opened a PR with currently adding the RowBase.getProps() (have not seen your comment unfortunately). If getRowPTOptions should include it already, I can check further where the style and className are lost. By the way, I needed to adjust a few ts interfaces by adding onToggle to Omit due to getting a build error (mentioned it in the PR). Is this currently present in the master code base? Error looks like this: "Type 'ToggleEvent is missing the following properties from type 'FieldSetToggleEvent': originalEvent, value". Just added it to Omit for now to be able to build it |
I think something is lost in ComponentBase getPTValue(). I am not sure which part inside of the getPTValue() should contain the corresponding props, I see in the final return of the function that mergeSections is true and useMergeProps is false, so this line is used for the return:
with globalPT and self being undefined again. Should self contain the rowProps or another variable? And should the row properties be returned in the ptm() or the ptmo() call? |
I assume, Why is the key actually set to 'root'? |
* Fix for #7329 * Fix const variables to let where required for build * Reset line changed by accident * Fixed build issues Types of property 'onToggle' are incompatible by adding to Omit * Reverted changes due to build issues with next version mismatch
Describe the bug
Hello,
it seems to me that this issue from 2 years ago is present again: #2693
I forked the CodeSandbox from the issue, updated primereact to the latest version and added classNames to both a Row and a Column component. While the column component sets the class, the row class stays unset. See Reproducer for an example. I was also able to reproduce it in another local project with a TreeTable as well.
Reproducer
https://codesandbox.io/p/sandbox/primereact-test-forked-7mt96v
System Information
Steps to reproduce the behavior
Using a Row component with setting style or className results in a < tr > without style or className.
Expected behavior
The resulting < tr > component should get the style or the class set.
The text was updated successfully, but these errors were encountered: