Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces autocomplete close after click on scroll bar

Tags:

jsf

primefaces

I am using Primefaces 6.2.

My problem is when I use autoComplete with dropDown=true and scrollHeight. Window close after I click on scroll bar. It works fine when I just use wheel on my mouse.

<p:autoComplete id="agendaSelect" scrollHeight="100" completeMethod="#{agendaAutoCompleteView.completeAgenda}" dropdown="true" itemValue="#{agenda}" var="agenda" itemLabel="#{agenda.displayName}" forceSelection="true" value="#{agendaAutoCompleteView.agenda}" converter="agendaConverter" required="true" requiredMessage="Pole Agenda musi byt vyplnene.">                           
    <p:ajax event="itemSelect" update="bunkaSelect" listener="#{bunkaAutoCompleteView.bunkaListener}" />                          
</p:autoComplete>
like image 573
user3437084 Avatar asked May 21 '18 07:05

user3437084


Video Answer


1 Answers

As temporary fix until the Bug is fixed you might use the following JS-Code somewhere on your page (e.g. upon onload).

$('body').on('mousedown', '.ui-autocomplete-panel', function(event) { event.stopImmediatePropagation();});

This would prevent the event currently leading to misbehaviour (closing the panel) to be carried out. It will work also for partial Requests/Responses as the event would be applied to future DOM Elements of the same class.

like image 159
Markus Brüderl Avatar answered Oct 12 '22 00:10

Markus Brüderl