-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
onPageChange event returns different event data (infinite scroll with lazy loading feature?) #116
Comments
Agreed, the API should be updated to match. Whats the advantage of the other change? I believe you can accomplish what you described currently. |
After firm look at the source, I actually found real reason why it was In DataTable.ts
should be DataTable.ts
"Whats the advantage of the other change?" This might be due to the bug: Even if above bug gets fixed, invoking onPageChange event on onBodyScroll event is not an good idea I think. (May be call onPageChange only when page changes?) In my opinion, better Idea would be splitting onPageChange event and loadData event (need better name than this) where - May be exposing extra TableOptions like: Well these were my thoughts |
Check out 0.5.1, I updated my API to return what you were expecting. I do not see that typo, you reference. Can you paste a link to the code in GH? Yup, I understand infinite vs virtual. Well technically my thought is infinite is when you hit the bottom of the page and loads next and virtual is the whole pane is painted w/ the exact count. You are talking about lazy-loading data based on virtual pagination. Which as far as I know should be supported, I have this in my app so I'll make a demo to illustrate this. I somewhat disagree with your point about body scroll not calling page because technically it is paging its just not from a traditional pager. It has to be triggered different though so the offset can be set if its triggered externally ( ie footer pager, outside api, etc ). Regarding the API suggestions, some thoughts:
|
That explanation clicked my brain. Thank you for the explanation 😄
I must have mistaken with different source. sorry for the confusion. |
No worries! Cheers! |
Hi All, I need to fetch 20 records at a time via a service using observable, this service takes page_number and item_per_page=20 values, and returns the data for the given page_number. Please help me on this or if you are able to give a sample code that would be great. Thanks for this wonderful data table. its very easy to implement and provides various functionalities. |
Hi, all
In the document
document
onPageChange: Triggered when the data-table is paged. Arguments: offset, limit, pageCount
but it returns just page value for now
DataTable.ts
onPageChanged(action) { this.state.setPage(action); this.onPageChange.emit(action.value); }
Just wondering, What if we could just make DataTable.ts subscribe event from State Service to match documentation?
DataTable.ts
Statets
and
this might allow angular2-data-table to support infinite scrolling with lazy-loading by
emitting "onPageChange" event from "Body.ts" onScroll
Body.ts
I currently have angular2-data-table working version of infinite scrolling with lazy-loading (not optimized yet) which also allow pagination at the same time.
any thoughts?
Thanks for the great library 👍
Andy
The text was updated successfully, but these errors were encountered: