mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-22 07:28:15 +08:00
no results state updates
This commit is contained in:
parent
5ed3a22539
commit
f7fe30fdae
1 changed files with 15 additions and 13 deletions
|
@ -459,21 +459,12 @@ var ExperimnetTable = {
|
||||||
this.filterDropdown.on('filter:apply', () => {
|
this.filterDropdown.on('filter:apply', () => {
|
||||||
$.each(this.filters, (_i, filter) => {
|
$.each(this.filters, (_i, filter) => {
|
||||||
this.activeFilters[filter.name] = filter.apply($experimentFilter);
|
this.activeFilters[filter.name] = filter.apply($experimentFilter);
|
||||||
|
|
||||||
// Prompt empty state when theres no filtered results
|
|
||||||
let values = Object.values(this.activeFilters);
|
|
||||||
let anyFilter = values.every(value => /^\s+$/.test(value) || value === null || value === undefined || value?.length === 0);
|
|
||||||
setTimeout(() => {
|
|
||||||
var tableRowLength = document.getElementsByClassName('table-row').length;
|
|
||||||
var emptyState = document.getElementById('tasksNoResultsContainer');
|
|
||||||
if (tableRowLength === 0 && !anyFilter) {
|
|
||||||
emptyState.style.display = 'block';
|
|
||||||
} else {
|
|
||||||
emptyState.style.display = 'none';
|
|
||||||
}
|
|
||||||
}, 250)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// filters are active if they have any non-empty value
|
||||||
|
let filtersEmpty = Object.values(this.activeFilters).every(value => /^\s+$/.test(value) || value === null || value === undefined || value && value.length === 0);
|
||||||
|
this.filtersActive = !filtersEmpty;
|
||||||
|
|
||||||
filterDropdown.toggleFilterMark(
|
filterDropdown.toggleFilterMark(
|
||||||
this.filterDropdown,
|
this.filterDropdown,
|
||||||
this.filters.some((filter) => {
|
this.filters.some((filter) => {
|
||||||
|
@ -507,6 +498,8 @@ var ExperimnetTable = {
|
||||||
$(this.table).find('.table-row').remove();
|
$(this.table).find('.table-row').remove();
|
||||||
this.appendRows(result.data);
|
this.appendRows(result.data);
|
||||||
this.initDueDatePicker(result.data);
|
this.initDueDatePicker(result.data);
|
||||||
|
this.handleNoResults();
|
||||||
|
|
||||||
InfiniteScroll.init(this.table, {
|
InfiniteScroll.init(this.table, {
|
||||||
url: dataUrl,
|
url: dataUrl,
|
||||||
eventTarget: window,
|
eventTarget: window,
|
||||||
|
@ -536,6 +529,15 @@ var ExperimnetTable = {
|
||||||
|
|
||||||
if (this.provisioningMyModulesCount > 0) this.pollProvisioningStatuses(provisioningStatusUrls);
|
if (this.provisioningMyModulesCount > 0) this.pollProvisioningStatuses(provisioningStatusUrls);
|
||||||
},
|
},
|
||||||
|
handleNoResults: function() {
|
||||||
|
let tableRowLength = document.getElementsByClassName('table-row').length;
|
||||||
|
let noResultsContainer = document.getElementById('tasksNoResultsContainer');
|
||||||
|
if (this.filtersActive && tableRowLength === 0) {
|
||||||
|
noResultsContainer.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
noResultsContainer.style.display = 'none';
|
||||||
|
}
|
||||||
|
},
|
||||||
pollProvisioningStatuses: function(provisioningStatusUrls) {
|
pollProvisioningStatuses: function(provisioningStatusUrls) {
|
||||||
let remainingUrls = [];
|
let remainingUrls = [];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue