문제

I have followed the documentation as best as I can. But I can't pin point the mistake here.

My view looks like this.

class ProductListView(LoginRequiredMixin, AjaxListView):
     model = Product
     paginate_by = 12
     template_name = 'products_list.html'
     page_template = 'products_page.html'

The template

 <div class="row">
     <ul id="products_list" class="thumbnails endless_page_template">
     {% include page_template %}
     </ul>
 </div>

The page template

{% load endless %}
 {% paginate 8 products_list %}
 {% for product in products_list %}
     <li class="span3">
         .
         .
         .
         <!-- each item html -->

     </li>
 {% endfor %}
 {% show_more %}

And this is what I put inside script tags on the same page.

$(document).ready(function(){
         $.endlessPaginate({
              paginateOnScroll: true,
              paginateOnScrollMargin: 20,                                 
         });
});

I looked at this question - django-endless-pagination doesn't seem to be using AJAX but didn't find any solutions there. I don't see any network call being made in the console when I reach the end of the scroll. The page loads with a show_more link at the end. When show_more link is clicked, it's loading the next page of items via ajax but this doesn't happen automatically as it should be when we set paginateOnScroll:true.

도움이 되었습니까?

해결책

After tinkering with endless_pagination.js, I found a fix. It works for me. Submitted a pull request here - https://github.com/frankban/django-endless-pagination/pull/52

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top