Skip to content Skip to sidebar Skip to footer

AngularJS Server Side Pagination On Mouse Scroll

I am looking for some technique which will get me started to do server side pagination on mouse scroll. I have a large data set which I want to load in chunks and later dynamic

Solution 1:

As of infinite scroll you could you use following example and change the loadMore() method so it calls server side just like this.

 $scope.loadMore = function () {
        $http.get('/someUrl').
        success(function (data, status, headers, config) {
            $scope.items.push(data); 
        }).
        error(function (data, status, headers, config) {
            // called asynchronously if an error occurs
            // or server returns response with an error status.
        });
    };

Solution 2:

What ngInfiniteScroll (http://binarymuse.github.io/ngInfiniteScroll/) does is load you "backend" by calling it each time a user scrolls, therefore what you need to implement is a backend written in your language of your preference that uses JSON (for simplicity sake or xml or whatever that can be parsed) to send data from your "massive dataset" by using some method of skip and steps where skip is the number of elements an index of the database are skipped and steps are the number of database registers from the the position of the skip index it is going to fetch.

So tell us which database technology are you using in order to implement the skip/steps technique for your infinite scroll.

ie:

MongoDB has Cursor Skip (more on that on the url below)

http://docs.mongodb.org/manual/reference/method/cursor.skip/


Post a Comment for "AngularJS Server Side Pagination On Mouse Scroll"