Comments (7)
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.
@jbetancur
Thanks for taking this issue seriously.
And I'm happy to contribute 😊 here.
from react-data-table-component.
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.
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.
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.
Closed by #80
from react-data-table-component.
@prince3339 no problem! Of course, contributions are always welcome! 👍
from react-data-table-component.
Related Issues (20)
- `onSelectedRowsChange` does not fire if `clearSelectedRows` is toggled
- In the data table when i select any cell and if i click just below that cell and move my mouse cursor the whole column get moved. HOT 2
- EXPAND ROW BY CLICK TO THE TEXT
- Second icons on rows per page element HOT 2
- Add custom icon on Expandable rows header
- Paginator select needs an id or name attribute
- Enable overflow scrollbars for expanded rows
- DataTable sort show two arrows up and down
- Add a Search option HOT 2
- I could not start with all rows
- custom-row: adding custom row component (at least a wrapper)
- sort function runs every time data changes
- Client Side Sorting with Custom UI: Need sorting done on client side, but the UI to be customizable
- [FEATURE]: [SHORT DESCRIPTION]Required Row freezing feature.
- [FEATURE]: [Expandable Rows with Breakpoint condition]
- Unable to Export Types from "react-data-table-component/dist/src/DataTable/types"
- If sorting again second column it removes previous sorting icons from table header column HOT 1
- selectableRowsSingle not working as expected
- Feature Request : Create Custom headers with ColSpan and RowSpan or if already available this feature then guide me
- Resizable columns in Tables
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-data-table-component.