Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endless pagination loads entire page contents on scroll #58

Open
sparkplugmarcus opened this issue Dec 3, 2013 · 4 comments
Open

Endless pagination loads entire page contents on scroll #58

sparkplugmarcus opened this issue Dec 3, 2013 · 4 comments

Comments

@sparkplugmarcus
Copy link

Thank you for the great app!

The initial view of the page works fine, but once scrolled a the entire page contents are loaded into the endless_page_template div.

The relevant parts of my view are below. I'm using a CreateView because I have the comments form on the same page as the paginated comments.

class MyIndex(CreateView):
    form_class = CommentForm
    template_name = 'my/index.html'
    page_template = 'my/comments.html'

    def get_context_data(self, **kwargs):
        context = super(MyIndex, self).get_context_data(**kwargs)
        context.update({
            'comments': Comment.objects.order_by('-id').filter(parent=None),
            'page_template': self.page_template,
        })

        return context

The relevant parts of my/index.html template (main template)

<script src="/static/endless_pagination/js/endless-pagination.js"></script>
<script type="text/javascript">
    $.endlessPaginate({
        paginateOnScroll: true
    });
</script>

<div class="endless_page_template">
    {% include page_template %}
</div>

The relevant parts of my/comments.html (page_template)

{% load endless %}

{% paginate comments %}
{% for comment in comments %}
    <span class="lead">{{ comment.name }}</span>
    {{ comment.message}}

    {% if not forloop.last %}
        <hr />
    {% endif %}
{% endfor %}
<br />

<div class="row-fluid">
    <div class="span8 offset2 pagination-centered">
        {% show_more %}
    </div>
</div>
@macdhuibh
Copy link

Looks like we're experiencing the same issue while using AjaxListView.
Did you ever find a fix / workaround?

@sparkplugmarcus
Copy link
Author

No, I'm just decided to not use scrolling. I posted a question on SO, but no answer.

http://stackoverflow.com/questions/20485004/endless-pagination-loads-entire-page-contents-on-scroll

@ghost
Copy link

ghost commented Jan 30, 2014

FWIW, I just encountered the same issue when I wrote:

{% paginate object_list using 'page_number' %}

putting the 'page_number' in quotes.

@suchanlee
Copy link

Although the issue seems to have been posted a month old, I ran into the issue as well several months ago and found that the problem was in evaluating the screen size. I'll take a further look at my fix and submit a pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants