changeset 33:7f18b34ec7ec

Fixed: Issue with image server search functionality Previously: - had to use tab or other weird combinations of tricks to get around the image server search. Fixed: - enter key now selects suggestion from search list and pressing a second time will send the search request. - 'selectFirst' property changed so that the user is able to search for their unique input and is not restricted to only the suggestion list. [Eg: searching simply 'Glaser' to get all related results] To-Do: *Possibly change so that pressing enter both selects the suggestion from the autocomplete list and searches the selection in one fluid command, rather than having to hit enter twice* Signed-off-by: Alistair-Russell <russell.alistair@gmail.com>
author arussell
date Thu, 21 May 2015 16:36:53 +0000
parents 86a9bb234663
children 9087a4623a08
files src/main/webapp/imageServer/displayDigiList.xhtml
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/webapp/imageServer/displayDigiList.xhtml	Thu May 21 10:36:37 2015 +0000
+++ b/src/main/webapp/imageServer/displayDigiList.xhtml	Thu May 21 16:36:53 2015 +0000
@@ -51,19 +51,31 @@
 						
 						<rich:column style="border:none;">
 							<f:facet name="header">
+								<script>
+									function handlerKeyPress(event) {
+										// if enter key is pressed
+										if (event.keyCode == 13) {
+											event.target.blur();
+											event.stopPropagation();
+											return false;
+										} else {
+											return true;
+										}
+									}
+								</script>
 								<h:outputText value="Digitalization" 
 									styleClass="rf-dt-shdr-c"/>
 								<br/>
 								<rich:autocomplete mode="client" autocompleteList="#{Session.digiList.suggesstionList}"
-	            					var="suggestion" fetchValue="#{suggestion}" layout="div"
-	            					value="#{Session.digiList.filterTerm}" >
+	            					var="suggestion" fetchValue="#{suggestion}" layout="div" selectFirst="false"
+	            					value="#{Session.digiList.filterTerm}" onkeypress="return handlerKeyPress(event);" >
 	            					<b>#{suggestion}</b>
-	            					<a4j:ajax event="change" render="digiListPanel" listener="#{Session.digiList.eventFilter}" />  
+									<a4j:ajax event="change" render="digiListPanel" listener="#{Session.digiList.eventFilter}" />
 	        					</rich:autocomplete>
 							</f:facet>
-							
+
 							<h:outputText value="[#{digi.entity.id}] #{digi.entity.ownValue}" />
-							
+
 							<h:outputLink value="#{ApplicationBean1.root}/imageServer/displayDigi.jsp?digiId=#{digi.entity.id}">
 								<h:graphicImage url="#{ApplicationBean1.displayImage}" width="18" height="18"/>
 							</h:outputLink>