mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 15:36:22 +08:00
Prevent loading empty next page in P/E infinite scroll [SCI-7160] (#4410)
This commit is contained in:
parent
9126b7fca4
commit
21f91089e9
|
@ -485,6 +485,11 @@ var ProjectsIndex = (function() {
|
||||||
if (viewContainer.find('.no-results-container').length) {
|
if (viewContainer.find('.no-results-container').length) {
|
||||||
viewContainer.addClass('no-results');
|
viewContainer.addClass('no-results');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!data.next_page) {
|
||||||
|
$(cardsWrapper).addClass('last-page');
|
||||||
|
}
|
||||||
|
|
||||||
selectedProjects.length = 0;
|
selectedProjects.length = 0;
|
||||||
selectedProjectFolders.length = 0;
|
selectedProjectFolders.length = 0;
|
||||||
updateProjectsToolbar();
|
updateProjectsToolbar();
|
||||||
|
@ -497,6 +502,7 @@ var ProjectsIndex = (function() {
|
||||||
placeholderTemplate: '#projectPlaceholder',
|
placeholderTemplate: '#projectPlaceholder',
|
||||||
endOfListTemplate: '#projectEndOfList',
|
endOfListTemplate: '#projectEndOfList',
|
||||||
pageSize: pageSize,
|
pageSize: pageSize,
|
||||||
|
lastPage: !!data.next_page,
|
||||||
customResponse: (response) => {
|
customResponse: (response) => {
|
||||||
$(response.cards_html).appendTo(cardsWrapper);
|
$(response.cards_html).appendTo(cardsWrapper);
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,6 +46,11 @@ var InfiniteScroll = (function() {
|
||||||
var $container = $(object);
|
var $container = $(object);
|
||||||
$container.data('next-page', 2);
|
$container.data('next-page', 2);
|
||||||
$container.data('config', config);
|
$container.data('config', config);
|
||||||
|
|
||||||
|
if (config.lastPage) {
|
||||||
|
$container.addClass('last-page');
|
||||||
|
}
|
||||||
|
|
||||||
if (config.loadFirstPage) {
|
if (config.loadFirstPage) {
|
||||||
loadData($container, 1);
|
loadData($container, 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue