Skip to content
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 - EventParams - wrong interface attribute #1983

Closed
msholto opened this issue Apr 24, 2021 · 2 comments
Closed

DataTable - EventParams - wrong interface attribute #1983

msholto opened this issue Apr 24, 2021 · 2 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@msholto
Copy link

msholto commented Apr 24, 2021

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

Current behavior
DataTable callback onRowClick?(e: RowClickEventParams): void; method uses RowClickEventParams which extends EventParams interface. This interface has 'value' attribute provided for row data. It compiles with typescript correctly, but in production, data are stored in attribute 'data', not in attribute 'value'.

export class BodyRow extends Component {

    onClick(event) {
        if (this.props.onClick) {
            this.props.onClick({
                originalEvent: event,
                data: this.props.rowData, // this should be 'value: this.props.rowData'
                index: this.props.rowIndex
            });
        }
    }

Expected behavior
EventParams interface will either rename 'value' into 'data' or fill 'value' attribute with row data.

Minimal reproduction of the problem with instructions

Create <DataTable onRowClick={e => {
                                   console.log(e.value); // returns undefined or null

                                   // @ts-ignore
                                   console.log(e.data); // returns data, but data is not present in 'e' as attribute
                               }}

Please tell us about your environment:
Windows 10, Intellij IDEA, npm v14.16.1, Spring boot backend

  • React version:
    "react": "^17.0.2",

  • PrimeReact version:
    "primereact": "^6.3.0",

  • Browser: [Chrome Version 90.0.4430.85 (Official Build) (64-bit)]

  • Language: [TypeScript 4.2.4 | ES5]

@mertsincan mertsincan self-assigned this Apr 25, 2021
@mertsincan mertsincan added the Type: Bug Issue contains a defect related to a specific component. label Apr 25, 2021
@mertsincan mertsincan added this to the 6.3.1 milestone Apr 25, 2021
@mertsincan
Copy link
Member

Hi,

6.3.1 Released. Could you please try it?

Best Regards,

@msholto
Copy link
Author

msholto commented Apr 26, 2021

Works. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

2 participants