primereact icon indicating copy to clipboard operation
primereact copied to clipboard

DataTable Passthrough: rowExpansion className not set in DOM

Open LouisTrinczek opened this issue 1 year ago • 1 comments

Describe the bug

When using the "rowExpansion" property in the DataTable Pass Through, the className is not set in the DOM.

Reproducer

https://stackblitz.com/edit/9dqyrn-cyspsk?file=src%2FApp.jsx

PrimeReact version

10.6.2

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Firefox 126.0, Chrome 125.0.6422.142

Steps to reproduce the behavior

Create a DataTable with all the necessary rowExpansion Code. Add the pt prop with these values:

pt={{
          bodyRow: { className: 'CUSTOM-ROW-CLASSNAME' },
          rowExpansion: { className: 'CUSTOM-ROW-EXPANSION-CLASSNAME' },
        }}

Go in your browsers dev tools and select the row.

You will find, that the "CUSTOM-ROW-CLASSNAME" is applied to the bodyRow, but not the "CUSTOM-ROW-EXPANSION-CLASSNAME" to the expanded row.

Expected behavior

Custom className is set to the rowExpansion element and styling is applied.

LouisTrinczek avatar Jun 21 '24 12:06 LouisTrinczek

The bug is here its looking on the Column for PT instead of the DataTable


                const rowExpansionProps = mergeProps(
                    {
                        id,
                        className: cx('rowExpansion'),
                        role: 'row'
                    },
                    getColumnPTOptions('rowExpansion')
                );

melloware avatar Jun 21 '24 13:06 melloware

@melloware Hi, I’m still encountering the same issue with the pt={{ rowExpansion: { className: '...' } }} not applying the className correctly to the expanded row.

I saw that this issue was confirmed — just wondering if the fix has already been released in the latest version? If not, is there an estimated release timeline?

Thanks for your help!

cacdivic avatar Mar 21 '25 11:03 cacdivic

@cacdivic no fix has been made yet that I am aware of. let me look at this.

melloware avatar Mar 21 '25 11:03 melloware

Fixed for next release

melloware avatar Mar 21 '25 12:03 melloware