Fix search count
This commit is contained in:
parent
b8493d8f5c
commit
c733f0a1d8
|
@ -4,7 +4,7 @@
|
||||||
* Author: BootstrapMade.com
|
* Author: BootstrapMade.com
|
||||||
* License: https://bootstrapmade.com/license/
|
* License: https://bootstrapmade.com/license/
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,8 +40,8 @@
|
||||||
/**
|
/**
|
||||||
* Sidebar toggle
|
* Sidebar toggle
|
||||||
*/
|
*/
|
||||||
if (select('.toggle-sidebar-btn')) {
|
if (select('.toggle-sidebar-btn')) {
|
||||||
on('click', '.toggle-sidebar-btn', function(e) {
|
on('click', '.toggle-sidebar-btn', function (e) {
|
||||||
select('body').classList.toggle('toggle-sidebar')
|
select('body').classList.toggle('toggle-sidebar')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
* Search bar toggle
|
* Search bar toggle
|
||||||
*/
|
*/
|
||||||
if (select('.search-bar-toggle')) {
|
if (select('.search-bar-toggle')) {
|
||||||
on('click', '.search-bar-toggle', function(e) {
|
on('click', '.search-bar-toggle', function (e) {
|
||||||
select('.search-bar').classList.toggle('search-bar-show')
|
select('.search-bar').classList.toggle('search-bar-show')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -110,10 +110,10 @@
|
||||||
/**
|
/**
|
||||||
* Initiate tooltips
|
* Initiate tooltips
|
||||||
*/
|
*/
|
||||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
||||||
var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) {
|
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||||
return new bootstrap.Tooltip(tooltipTriggerEl)
|
return new bootstrap.Tooltip(tooltipTriggerEl)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiate quill editors
|
* Initiate quill editors
|
||||||
|
@ -184,8 +184,8 @@
|
||||||
var needsValidation = document.querySelectorAll('.needs-validation')
|
var needsValidation = document.querySelectorAll('.needs-validation')
|
||||||
|
|
||||||
Array.prototype.slice.call(needsValidation)
|
Array.prototype.slice.call(needsValidation)
|
||||||
.forEach(function(form) {
|
.forEach(function (form) {
|
||||||
form.addEventListener('submit', function(event) {
|
form.addEventListener('submit', function (event) {
|
||||||
if (!form.checkValidity()) {
|
if (!form.checkValidity()) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
@ -206,16 +206,16 @@
|
||||||
/**
|
/**
|
||||||
* Autoresize echart charts
|
* Autoresize echart charts
|
||||||
*/
|
*/
|
||||||
const mainContainer = select('#main');
|
const mainContainer = select('#main');
|
||||||
if (mainContainer) {
|
if (mainContainer) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
new ResizeObserver(function() {
|
new ResizeObserver(function () {
|
||||||
select('.echart', true).forEach(getEchart => {
|
select('.echart', true).forEach(getEchart => {
|
||||||
echarts.getInstanceByDom(getEchart).resize();
|
echarts.getInstanceByDom(getEchart).resize();
|
||||||
})
|
})
|
||||||
}).observe(mainContainer);
|
}).observe(mainContainer);
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select all functionality
|
* Select all functionality
|
||||||
|
@ -280,15 +280,15 @@
|
||||||
let resultCount = 0;
|
let resultCount = 0;
|
||||||
function searchCompleted() {
|
function searchCompleted() {
|
||||||
resultCount++;
|
resultCount++;
|
||||||
if (resultCount < 2 && document.getElementById("dropdown-search-list").children.length > 0) {
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
if (resultCount == 2 && document.getElementById("dropdown-search-list").children.length == 2) {
|
||||||
document.getElementById("dropdown-search-list").innerHTML = `
|
document.getElementById("dropdown-search-list").innerHTML = `
|
||||||
<li id="deviceSearchLoader" class="dropdown-item">
|
<li id="deviceSearchLoader" class="dropdown-item">
|
||||||
<i class="bi bi-x-lg"></i>
|
<i class="bi bi-x-lg"></i>
|
||||||
<span style="margin-right: 10px">Nothing found</span>
|
<span style="margin-right: 10px">Nothing found</span>
|
||||||
</li>`
|
</li>`
|
||||||
}, 100)
|
}
|
||||||
}
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
timeoutHandler = setTimeout(async () => {
|
timeoutHandler = setTimeout(async () => {
|
||||||
|
|
Reference in New Issue