I have developed template for viewing the group list in my django application. What I came to know is that, after more groups, the page is scrolling down. I am unable to see
1. Parse the object_list into a JSON object: This should allow you to provide the client with all the groups that exist in order to achieve your goal to keep the user on the same page.
2. Use jQuery or Javascript to refresh your html container that has the groups listed: Based on the size and type of data, you can also write a new view that returns a filtered JSON object to a post method in Javascript.
Example: https://codepen.io/elmahdim/pen/sGkvH
/*
Load more content with jQuery - May 21, 2013
(c) 2013 @ElmahdiMahmoud
*/
$(function () {
$("div").slice(0, 4).show();
$("#loadMore").on('click', function (e) {
e.preventDefault();
$("div:hidden").slice(0, 4).slideDown();
if ($("div:hidden").length == 0) {
$("#load").fadeOut('slow');
}
$('html,body').animate({
scrollTop: $(this).offset().top
}, 1500);
});
});
$('a[href=#top]').click(function () {
$('body,html').animate({
scrollTop: 0
}, 600);
return false;
});
$(window).scroll(function () {
if ($(this).scrollTop() > 50) {
$('.totop a').fadeIn();
} else {
$('.totop a').fadeOut();
}
});