The oncomplete attribute of oncomplete components does not support the evaluation of query-based EL expressions. One way is to use RequestContext#execute() inside the onDateSelect the listener method instead of oncomplete .
RequestContext requestContext = RequestContext.getCurrentInstance(); if (isWeekDay(onDateSelect.getDate())) { requestContext.execute("eventDialog.show()"); } else { requestContext.execute("myschedule.update()"); }
Another way is ajax-update a <h:outputScript> block containing the required EL expressions.
<p:ajax event="dateSelect" listener="#{myBean.onDateSelect}" update="script" /> ... <h:panelGroup id="script"> <h:outputScript> if (#{myBean.weekDaySelected}) { eventDialog.show() } else { myschedule.update() } </h:outputScript> </h:panelGroup>
source share