Comments (7)
I found a solution to my problem but I'm not sure if it is the best way to go .
I did a bit of digging and then called the setCurrentPage function and manually set it to 1 paginationService.setCurrentPage(paginationId, 1) under $watchCollection (probably line no 82).
Please reply and authenticate!
from angularutils.
Hi,
I'm not familiar with x-editable, but in general you can manipulate the current page of pagination by using the current-page
attribute on the dir-paginate
directive.
For example, you if you added current-page="currentPage"
to the directive, then you are telling it to bind the current page to the value of $scope.currentPage
.
In this case, you can have a method in your controller which you call when a new row is added, which simply does $scope.currentPage = 1
. This will set the pagination back to the first page.
from angularutils.
Thanks !
from angularutils.
Hey guys...
I've the same problem, I tried to do $scope.currentPage = 1, but doesn't work.
I wonder if there's another way to force the paging go to No. 1 after clicking a button.
Thanks
from angularutils.
Hi,
Could you show your code and I can see if there is a reason why it is not working?
from angularutils.
In my directive: (in coffeeScript)
scope.currentPage = 1 scope.callService = () -> //... call $http.get ... scope.currentPage = 1
In my view: (haml)
%dir-paginate{"current-page" => "currentPage"} %button{"ng-click"=>"callService()"> View More
After clicked in the button, will called the service and current-page need to be the first page again, but this not happened.
You know why?
from angularutils.
Hi,
I found a solution:
function(collection) {
if (collection) {
**paginationService.setCurrentPage(paginationId, 1);**
var collectionLength = (collection instanceof Array) ? collection.length : Object.keys(collection).length;
paginationService.setCollectionLength(paginationId, collectionLength);
}
from angularutils.
Related Issues (20)
- Breadcrumbs could not handle multiple paths to access a particular state. HOT 1
- dirPagination: Pagination control is broken when using Multiple Pagination with Asynchronous Data HOT 1
- passing Empty Array to directive HOT 1
- dirPagination: 'dirPagination' is not in the npm registry.
- I am not able to use other custom directive with dirPaginate?
- async with filtering ?
- dirpaginate is not working inside a script type="text/ng-template" used for showing angular modals and the script is the child of another dirpaginate. Both dirpaginate is not working as expected.
- How to implement check all/uncheck all in dirPagination?
- How can I set the page number from the controller?
- Dirpagination in controller for thousand of data HOT 1
- How can I obtain the current index, and how can I set an existing page in specific? HOT 1
- How to exclude certain array items from total item count on current page HOT 1
- uiBreadcrumbs + ui-router V1 HOT 1
- dirPagination: repeating on object has least items on first page rather than last
- Displaying error
- dirPagination:hide() is not working in navigation
- Custom Pagination Button Style HOT 2
- Finally including this loading flag when pages are changed and query is returned API HOT 1
- dirPagination loading issue when total-items is more then 100000 even calling from server side HOT 2
- DirPagination for asynchronous call not working in angular js
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 angularutils.