I'm developing a new node where I need autocompletion in an input field which is located inside a popup dialog:
var formField = $('<form/>');
// Create a dropdown, that represents the property name
var propertyNameField = $('<input/>', {class:"node-input-trace-name", type:"text", placeholder:"Property name", name:"propertyName"}).css({"width":"70%","margin-left":"5px","margin-right":"5px","z-index":"10000"}).appendTo(formField);
propertyNameField.autocomplete({
source: function(req, add){
var properties =["prop_A", "prop_B", "prop_C"];
add($.ui.autocomplete.filter(properties || [] , req.term));
}
});
formField.dialog({
modal: true,
title: 'Enter a trace property name',
zIndex: 10000,
resizable: false,
buttons: {
'OK': function () {
var name = $('input[name="propertyName"]').val();
alert("Name = " + name);
$(this).dialog('close');
},
'Cancel': function () {
$(this).dialog('close');
}
}
});
I have written this code, similar like @Steve-Mcl has done it for our SVG node.
The dialog appears correctly, but no autocomplete options are displayed:
Normally a list of all corresponding options (in this case "prop_A", "prop_B" and "prop_C") should be displayed ...
I have no clue why it doesn't work, because I arrive in the "source" callback function (for every character that I enter):