N°9468 - Make the 4px height difference a variable

This commit is contained in:
Stephen Abello
2026-04-13 11:48:38 +02:00
parent 229f6df925
commit 6c8b51bb77
2 changed files with 6 additions and 4 deletions

View File

@@ -120,6 +120,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
this.sFormAttCode = sFormAttCode;
var me = this;
const iDropdownContentHeightDifference = 4;
this.Init = function () {
// make sure that the form is clean
@@ -353,13 +354,13 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
if(oDropdownContentElem) {
oDropdownContentElem.css('max-height', 'calc(30vh - 4px)');
oDropdownContentElem.css('max-height', `calc(30vh - ${iDropdownContentHeightDifference}px)`);
}
/* Position dropdown above input if not enough space on the bottom part of the screen
Doesn't seem to work with selectize as an internal plugin "auto_position" refreshes the top position after
this method is called, input set use a custom plugin to avoid fix this issue "plugin_combodo_auto_position"
This would need to take the potential 4px difference into account if this is fixed.
This would need to take the potential 4px difference (iDropdownContentHeightDifference) into account if this is fixed.
*/
if ((fDropdownTopY / fWindowHeight) > 0.6) {
oDropdownElem.css({

View File

@@ -19,6 +19,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
// Selectize instance
let oSelf = this;
const iDropdownContentHeightDifference = 4;
// Plugin options
aOptions = $.extend({
@@ -53,7 +54,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
iDropdownHeight = oSelf.$dropdown.outerHeight();
oSelf.$dropdown.css({
top: oSelf.$control.offset().top - iDropdownHeight + 4, // Content will be shorter, so our real height too
top: oSelf.$control.offset().top - iDropdownHeight + iDropdownContentHeightDifference, // Content will be shorter, so our real height too
left: oSelf.$control.offset().left,
width: oSelf.$wrapper.outerWidth(),
overflowY: 'auto',
@@ -62,7 +63,7 @@ Selectize.define("combodo_auto_position", function (aOptions) {
// N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar
oSelf.$dropdown_content.css({
'max-height': `calc(${aOptions.maxDropDownHeight} - 4px)`
'max-height': `calc(${aOptions.maxDropDownHeight} - ${iDropdownContentHeightDifference}px)`
});
}