diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js index d4e5f189a0a0e16db0ef2c021fd2e396650a18eb..2fb5f787c14ca540a6fdeae0a14b083db4643abc 100644 --- a/src/core/js/edit_mode.js +++ b/src/core/js/edit_mode.js @@ -1021,13 +1021,23 @@ var edit_mode = new function () { edit_mode.fill_reference_drop_down(select[0], _options, property.value); result.empty(); result.append(select); + // value=NA means that the first element is the warning that not all entities are provided if(_options[0].getAttribute('value') == "NA") { + // The button to show the input field for manual ID insertion + var manualInsertButton = $('<button title="Insert Entity Id manually." class="btn btn-link caosdb-update-entity-button caosdb-f-list-item-button"><i class="bi-pencil"></i></button>'); + $(manualInsertButton ).click(function () { + // show ID input; hide dropdown + $(result).find('.dropdown').hide(); + $(result).find('input').show(); + }); // Add input for manual ID insertion idinput = $("<input type='number' value=''></input>") idinput.hide() - // When Enter is pressed, the insertion is completed + // Add callback for pressing Enter: the insertion is completed idinput.on('keyup', function(e){ if (e.key === 'Enter' || e.keyCode === 13) { + // hide the input, show the dropdown again and append the value that + // was entered to the candidates and select that item idinput.hide(); var sel_id = idinput[0].value select.append(`<option value="${sel_id}">ID: ${sel_id}</option>`); @@ -1039,11 +1049,6 @@ var edit_mode = new function () { } }); result.append(idinput); - var manualInsertButton = $('<button title="Insert Entity Id manually." class="btn btn-link caosdb-update-entity-button caosdb-f-list-item-button"><i class="bi-pencil"></i></button>'); - $(manualInsertButton ).click(function () { - $(result).find('.dropdown').hide(); - $(result).find('input').show(); - }); result.parent().append(manualInsertButton); } edit_mode._init_select(select); @@ -1868,7 +1873,7 @@ var edit_mode = new function () { */ this.retrieve_datatype_list = async function (datatype) { var find_entity = ["FILE", "REFERENCE"].includes(datatype)? "" : `"${datatype}"`; - const max_options = 25; + const max_options = 100; //for each query; there might be more candidates in total // TODO cache this? var n_entities = datatype !== "FILE" ? edit_mode.query(`COUNT Record ${find_entity}`, true) : 0; var n_files =edit_mode.query(`COUNT File ${find_entity}`, true);