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

TreeTable: TreeTablePageEvent props do not match #6842

Closed
wonlee6 opened this issue Jul 5, 2024 · 2 comments · Fixed by #6848, leoo1992/GeradorQRCode#80 or leoo1992/GeradorQRCode#85 · May be fixed by mtech-31-quemistry/quemistry_client_web#20
Assignees
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@wonlee6
Copy link

wonlee6 commented Jul 5, 2024

Describe the bug

/**
 * Custom page event.
 * @see {@link TreeTableProps.onPage}
 * @event
 */
interface TreeTablePageEvent {
    /**
     * Index of the first row.
     */
    first: number;
    /**
     * Rows per page.
     */
    rows: number;
    /**
     * Value of the new page.
     */
    page: number;
    /**
     * Total number of pages.
     */
    pageCount: number;
}

but return value in onPage

 const onPage = (event: TreeTablePageEvent) => {
        setLoading(true);

        //imitate delay of a backend call
        setTimeout(() => {
            setFirst(event.first);
            setRows(event.rows);
            setNodes(loadNodes(event.first, event.rows));
            setLoading(false);
        }, 500);
    };
// event
{first: 10, rows: 10, page: 1, totalPages: 100}

Reproducer

https://stackblitz.com/edit/lgmskl?file=src%2FApp.tsx,node_modules%2Fprimereact%2Ftreetable%2Ftreetable.d.ts

PrimeReact version

10.6.6

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

chrome

Steps to reproduce the behavior

No response

Expected behavior

No response

@wonlee6 wonlee6 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 5, 2024
@sja-cslab
Copy link
Contributor

@wonlee6 you want to submit a PR?

@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 5, 2024
@melloware melloware self-assigned this Jul 5, 2024
@melloware melloware added this to the 10.7.1 milestone Jul 5, 2024
melloware added a commit to melloware/primereact that referenced this issue Jul 5, 2024
@melloware
Copy link
Member

It was an easy change. PR submitted. Thanks for reporting @wonlee6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment