primefaces selectOneMenu ajax even on click not working

381 Views Asked by At

I am unable to get the ajax event click to work with primefaces selectOneMenu. Using the latest primefaces 11.0. The documentation states that these are available ajax events: blur, change, click, dblclick, focus, itemSelect, keydown, keypress, keyup, mousedown, mousemove, mouseout, mouseover, mouseup, select, valueChange.

<p:selectOneMenu value="#{beam.event}" editable="false" id="event">
    <f:selectItems value="#{beam.events}"/>
    <p:ajax event="click" onstart="console.log('start 1');" immediate="true" listener="#{beam.onClick}" update="@this"/>
    <p:ajax event="click" onstart="console.log('start 2');" immediate="true" listener="#{beam.onClickNoParam}" update="@this"/>
</p:selectOneMenu>

The onstart client side callbacks are not triggered. The beam listeners look like this:

public void onClick(AjaxBehaviorEvent event) {
    System.out.println("onClick");
}

public void onClickNoParam() {
    System.out.println("onClick");
}

I did get the focus event to work, but it is triggered way to many times and unfortunately in combination with the the update one gets stuck in an endless recursive loop.

I don't notice any issues when the click event is registered by the AjaxBehaviorHandler/AjaxBehaviorListenerImpl compared to the focus event.

0

There are 0 best solutions below