fix typeahead menu

This commit is contained in:
Uwe Steinmann 2024-03-30 12:00:04 +01:00
parent 929ceb91e4
commit f06267dd0b
3 changed files with 13 additions and 6 deletions

View File

@ -16,6 +16,7 @@
- set default language in login form if language selector is turned off
- do not show full list of notifiers to none admins
- do not list document/folders in sequence selector if its number exceeds 50
- typeahead menu works with arrow keys again, wait 1 sec. before searching
--------------------------------------------------------------------------------
Changes in version 5.1.33

View File

@ -38,6 +38,7 @@
this.source = this.options.source
this.$menu = $(this.options.menu)
this.shown = false
this.timeout = null
this.listen()
}
@ -254,7 +255,11 @@
break
default:
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.lookup()
}, 1000);
}
e.stopPropagation()

View File

@ -93,8 +93,8 @@ function initMost() {
* for each hit and render could only process strings.
* */
$("#searchfield").typeahead({ /* {{{ */
menu: '<div class="typeahead dropdown-menu"></div>',
item: '<li><a class="dropdown-item" href="#"></a></li>',
menu: '<div class="typeahead dropdown-menu" style="max-height: 500px; overflow-y: auto;"></div>',
item: '<a class="dropdown-item" href="#"></a>',
minLength: 3,
items: 100, /* the query will limit the number of hits */
source: function(query, process) {
@ -170,7 +170,8 @@ function initMost() {
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item.name).attr('data-id', item.id).attr('data-type', item.type);
i.find('a').html(that.highlighter(item))
/* i is already the 'a' tag, there is no 'li' as used by bootstrap 2 */
i./*find('a').*/html(that.highlighter(item))
return i[0]
})
@ -184,7 +185,7 @@ function initMost() {
/* Document chooser */
$("[id^=choosedocsearch]").typeahead({ /* {{{ */
menu: '<div class="typeahead dropdown-menu"></div>',
item: '<li><a class="dropdown-item" href="#"></a></li>',
item: '<a class="dropdown-item" href="#"></a>',
minLength: 3,
source: function(query, process) {
// console.log(this.options);
@ -222,7 +223,7 @@ function initMost() {
items = $(items).map(function (i, item) {
i = $(that.options.item).attr('data-value', item.name).attr('data-id', item.id).attr('data-type', item.type);
i.find('a').html(that.highlighter(item))
i./*find('a').*/html(that.highlighter(item))
return i[0]
})