DirPaginate: Update pagination on change data array
See original GitHub issueHey Michael,
Thanks a million for this directive it is amazing.
I’m using this directive in a custom table directive that I wrote. Items in the table can be deleted and new items could be added by the user. Now when I delete or add an items the pagination does NOT update by itself. I might be missing something but as far as I can see I can’t refresh the pagination with the current options.
Down to the question: Is the currently a way to update the pagination once the data array changes?
For all clearity. In the following example ‘items’ would be what I mean with data array:
<li dir-paginate="item in items | itemsPerPage: 10">{{ item }}</li>
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
dir-pagination directive angularjs - Stack Overflow
Update you booking list object inside your filter function . Since its two way data binding updating the booking list object might recalculate...
Read more >Search filter is too slow in angularjs with large dataset
I have AngularJs client application which displays data in table using dir-paginate directive of dirPagination.js
Read more >Simple Frontend Pagination | React - YouTube
In this video we will implement some custom pagination in React to get a certain number of fetched posts per page. We will...
Read more >dir-pagination using $index, $first, $last etc. - Plunker
Code goes here var myApp = angular.module('myApp', ['angularUtils.directives.dirPagination']); function MyController($scope) { $scope.
Read more >Server Side Pagination in AngularJS - Ciphertrick
At the client side again we will be using dir-paginate like we ... getData = function(pageno){ // This would fetch the data on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay I see why you were getting that unexpected behaviour. You are correct in that this a an Angular-related issue rather than something specific to this module.
Here is how I would handle this: instead of an ng-if on the
deleted
property, you could add an additional filter using a custom predicate function:Demo: http://plnkr.co/edit/Pl3BHqhngjxftzzrkEbC?p=preview
Hi,
When you say “refresh”, do you mean that the collection length has not changed, but the contents themselves have changed?
As far as I am aware (and I just tested it out in plunker (http://plnkr.co/edit/jcQ6jFq6oGOn1VlUnoYl?p=preview), if you change the collection, it should update automatically.
This of course assumes that any changes made are done within the Angular digest cycle. That is to say, if your collection is modified by some code external to Angular, then you might have to call a $scope.$apply(); to force Angular to check the changes.
If none of that helps, please get back to me with more specifics of what you are trying to do.