Code Monkey home page Code Monkey logo

Comments (7)

jbetancur avatar jbetancur commented on August 17, 2024 1

Ok, I'll be adding a new optional property named paginationTotalRows that can be used to override data.length. In addition, onChangePage will return both the current index and total row count so it can also be accessed within that callback.

Thanks for finding this issue @prince3339 . I'll also need to add a new demo for server-side pagination but will do that in a separate issue

from react-data-table-component.

prince3339 avatar prince3339 commented on August 17, 2024 1

@jbetancur
Thanks for taking this issue seriously.
And I'm happy to contribute 😊 here.

from react-data-table-component.

jbetancur avatar jbetancur commented on August 17, 2024

Hello @prince3339,

I'm not completely clear on what you are asking for. Do you just need the callback for Pagination to return the total number of records? Can you give me a workflow or code sample of what you are trying to achieve?

from react-data-table-component.

prince3339 avatar prince3339 commented on August 17, 2024

Hey @jbetancur,
In this library, you are setting total page number based on data length. But in my case I don't have all the data in the first place. I know the total records from the query. Say in database there 200 records. I know that number.
Now say, I have set the page limit 20. So in one query/api call I get 20 records. And total page should be Math.ceil(200/20).
Here the problem arises. Instead of Math.ceil(total records(200)/20), you are doing Math.ceil(Data.length/20). So I won't be able to get all my data based on correct pagination.

I hope you understand now.

from react-data-table-component.

jbetancur avatar jbetancur commented on August 17, 2024

Yea, I see the issue now. The code assumes that you are paging a fixed row total count, but is not accounting for the case where an actual pagination API query is being performed.

I'll see about providing a new property.

from react-data-table-component.

jbetancur avatar jbetancur commented on August 17, 2024

Closed by #80

from react-data-table-component.

jbetancur avatar jbetancur commented on August 17, 2024

@prince3339 no problem! Of course, contributions are always welcome! 👍

from react-data-table-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.