GithubHelp home page GithubHelp logo

Comments (7)

rahil471 avatar rahil471 commented on June 30, 2024

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.

michaelbromley avatar michaelbromley commented on June 30, 2024

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.

rahil471 avatar rahil471 commented on June 30, 2024

Thanks !

from angularutils.

williamsousa avatar williamsousa commented on June 30, 2024

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.

michaelbromley avatar michaelbromley commented on June 30, 2024

Hi,

Could you show your code and I can see if there is a reason why it is not working?

from angularutils.

williamsousa avatar williamsousa commented on June 30, 2024

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.

giumarzo avatar giumarzo commented on June 30, 2024

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)

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.