Autovervollständigung klappt nun wieder

This commit is contained in:
rxf
2025-12-22 10:30:27 +01:00
parent 2e8e010ceb
commit 77dc29fa9c

View File

@@ -284,10 +284,6 @@ function addEditbox(detail) {
//bei der Eingabe der BEOs eine Autovervollständigung durchführen //bei der Eingabe der BEOs eine Autovervollständigung durchführen
function buildBeosComplete() { function buildBeosComplete() {
let names=[]
for (x in beos) {
names.push(x.name)
}
function split( val ) { function split( val ) {
return val.split( /,\s*/ ); return val.split( /,\s*/ );
@@ -296,6 +292,19 @@ function buildBeosComplete() {
return split( term ).pop(); return split( term ).pop();
} }
// Konvertiere beos Array: wenn Objekte, extrahiere die Namen
var beosNames = beos.map(function(item) {
if (typeof item === 'string') {
return item;
} else if (item && item.name) {
return item.name;
} else {
return String(item);
}
});
console.log("buildBeosComplete - Original beos:", beos);
console.log("buildBeosComplete - Converted names:", beosNames);
$( "#curmar" ) $( "#curmar" )
// don't navigate away from the field on tab when selecting an item // don't navigate away from the field on tab when selecting an item
@@ -309,8 +318,11 @@ function buildBeosComplete() {
minLength: 0, minLength: 0,
source: function( request, response ) { source: function( request, response ) {
// delegate back to autocomplete, but extract the last term // delegate back to autocomplete, but extract the last term
response( $.ui.autocomplete.filter( var term = extractLast( request.term );
beos, extractLast( request.term ) ) ); console.log("Searching for:", term);
var filtered = $.ui.autocomplete.filter(beosNames, term);
console.log("Filtered results:", filtered);
response( filtered );
}, },
focus: function() { focus: function() {
// prevent value inserted on focus // prevent value inserted on focus