diff --git a/src/main/resources/META-INF/resources/marty/imixs-marty.js b/src/main/resources/META-INF/resources/marty/imixs-marty.js index a63774de..e0d5fa5b 100644 --- a/src/main/resources/META-INF/resources/marty/imixs-marty.js +++ b/src/main/resources/META-INF/resources/marty/imixs-marty.js @@ -19,27 +19,14 @@ IMIXS.org.imixs.marty = (function () { // init user input fields... $(document).ready(function () { - // add autocomplete feature to all user inputs... - // var userInputField = $("input[data-item='marty.user.input']"); - // $(userInputField).each(function () { - // console.log('---------___> Init userinput'); - // imixsMarty.userInputInit(this, martyUserSearch, 'marty-userinput-resultlist'); // optional callback method allowed here! - // }); - var userGroupInputField = $("textarea[data-item='marty.user.input']"); $(userGroupInputField).each(function () { imixsMarty.userInputInit(this, martyUserSearch, 'marty-userinput-resultlist'); // optional callback method allowed here! }); - - }); - - - - /* * initializes an input element for autocompletion. * the param 'resultlistid' is optional and defines the element @@ -48,12 +35,10 @@ IMIXS.org.imixs.marty = (function () { * from the suggest list */ var userInputInit = function (inputElement, searchCallback, resultlistId, selectCallback) { - // should be hidden $(inputElement).hide(); hideResultList(inputElement); autocompleteSearchReady = false; - // set id for result list element if (!resultlistId || resultlistId === '') { resultlistId = 'autocomplete-resultlist'; // default name @@ -147,7 +132,12 @@ IMIXS.org.imixs.marty = (function () { var id = $(inputElement).data('resultlist'); var parent = $("[id$='" + id + "']"); var resultElementListActive = $(".marty-userinput-resultlist-element.active", parent); - $("a", resultElementListActive).click(); + if (resultElementListActive.length > 0) { + $("a", resultElementListActive).click(); + } else { + // special use case overtake current input + selectUserID($(inputElement).val(), $(inputElement).val()); + } hideResultList(inputElement); }, @@ -197,10 +187,6 @@ IMIXS.org.imixs.marty = (function () { $(resultElementList[autcompleteSelectedElement]).addClass("active"); }, - - - - selectUserID = function (userid, username) { // find the value field and the search field var inputSearchField = $('input[name ="' + autocompleteInputID + '"]'); @@ -247,10 +233,8 @@ IMIXS.org.imixs.marty = (function () { // clear input inputSearchField.val(''); } - }, - /* Deletes a given user id form a usergroup list */ deleteUserID = function (link) { // find the value field based on the given link. @@ -283,14 +267,9 @@ IMIXS.org.imixs.marty = (function () { inputField.val(newValue); // trigger on change event inputField.trigger('change'); - } - - }, - - /* * delay function * see: https://stackoverflow.com/questions/1909441/how-to-delay-the-keyup-handler-until-the-user-stops-typing @@ -320,5 +299,3 @@ IMIXS.org.imixs.marty = (function () { // Define public namespace var imixsMarty = IMIXS.org.imixs.marty; - - diff --git a/src/main/resources/META-INF/resources/marty/userSearch.xhtml b/src/main/resources/META-INF/resources/marty/userSearch.xhtml index ce0ff0d9..f0a1842a 100644 --- a/src/main/resources/META-INF/resources/marty/userSearch.xhtml +++ b/src/main/resources/META-INF/resources/marty/userSearch.xhtml @@ -20,7 +20,7 @@ - default pos +