Home Infinite scroll duplicates rows
Reply: 0

Infinite scroll duplicates rows

user1116 Published in March 24, 2018, 12:46 am

I'm ngInfiniteScroll dependency for AngularJS framework. https://sroze.github.io/ngInfiniteScroll/

It's assigned to my table.

<table infinite-scroll="loadMore()" ng-controller="LastBookingsCtrl">

Here's the loadMore function in my javascript file.

$scope.loadMore = function() {
$http.get("last.php?start=" + $scope.currentLoadIndex)
    .then(function (res) {
        if (res.data.length > 0) {
            var count = 0;
                for (var i = 0; i < res.data.length; i++) {
            $scope.currentLoadIndex += count;

And I think my mysql query in load.php is correct, but I'm not sure.

$start = $_GET['start'];
$query = "SELECT * FROM `performs` ORDER BY id DESC LIMIT ".$start.", 20";

It gives me 20 rows of from my mysql start from a variable number.

But whenever I scroll up and down again, it duplicates somehow.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.299881 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO