fixed tagsinput and tooltip js error.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-01-31 08:44:59 -07:00
parent ca65a6fb71
commit a49121b1d9
2 changed files with 12 additions and 5 deletions

View File

@@ -45,15 +45,21 @@ function loadPinnedNotes(vehicleId) {
new bootstrap.Tooltip(hoveredGrid); new bootstrap.Tooltip(hoveredGrid);
hoveredGrid.tooltip("show"); hoveredGrid.tooltip("show");
} else { } else {
//disable the tooltip
//hoveredGrid.attr("data-bs-toggle", "");
hoveredGrid.attr("data-bs-title", ""); hoveredGrid.attr("data-bs-title", "");
} }
}); });
} else { } else {
hoveredGrid.tooltip("show"); if (hoveredGrid.attr("data-bs-title") != '') {
hoveredGrid.tooltip("show");
}
} }
} }
function hidePinnedNotes(vehicleId) { function hidePinnedNotes(vehicleId) {
$(`#gridVehicle_${vehicleId}`).tooltip("hide"); if ($(`#gridVehicle_${vehicleId}`).attr('data-bs-title') != '') {
$(`#gridVehicle_${vehicleId}`).tooltip("hide");
}
} }
function filterGarage(sender) { function filterGarage(sender) {

View File

@@ -429,12 +429,13 @@
self.$input.attr('disabled', 'disabled'); self.$input.attr('disabled', 'disabled');
return; return;
} }
var text = $input.val(), var text = $input.val(),
maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars; maxLengthReached = self.options.maxChars && text.length >= self.options.maxChars;
if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) { if (self.options.freeInput && (keyCombinationInList(event, self.options.confirmKeys) || maxLengthReached)) {
// Only attempt to add a tag if there is data in the field //check if confirm keys are in input and then replace them.
if (text.length !== 0) { text = text.replace(String.fromCharCode(event.which), "")
// Only attempt to add a tag if there is data in the field
if (text.length !== 0) {
self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text); self.add(maxLengthReached ? text.substr(0, self.options.maxChars) : text);
$input.val(''); $input.val('');
} }