primefaces 6 schedule dateSelect on double click - events

I'm using the p:schedule component from Primefaces 6.0.
The event dateSelect is fired by a click.
<p:schedule ...>
<p:ajax event="dateSelect" listener="#{scheduleView.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />
How can this event be fired only on a doubleclick ?
Thanks

Related

Session get lost even if I am interacting on page

I'm working with primefaces 3.4.2 Javax.faces 2.1.9
My web.xml
<session-config>
<session-timeout>45</session-timeout>
</session-config>
<p:idleMonitor id="idMonitorSession" timeout="2400000"
onidle="dlgMensajeSessionExp.show()" />
<p:dialog header="Sesion Ended" resizable="false"
widgetVar="dlgMensajeSessionExp" width="300" height="120"
modal="true" closable="false" appendToBody="true">
<center>
<h:outputText value="Session Ended" />
<h:form id="sessionForm">
<h:commandLink actionListener="#{user.exit()}">
<h:graphicImage style="border:0px" value="/resources/images/login.png"
width="80px" />
</h:commandLink>
</h:form>
</center>
</p:dialog>
However session get lost even if i am working in the pages, do you have any idea why is this happening,
Web Server is Websphere 7.0.0.17
Interacting with the page in such a way that the server isn't invoked via ajax or a complete form post doesn't reset the timeout against the session server side. Using ajax events for the idleMonitor should do the trick.
<p:idleMonitor id="idMonitorSession" timeout="2400000"
onidle="dlgMensajeSessionExp.show()">
<p:ajax event="active"/>
</p:idleMonitor>
Edit: I noticed the "active" event doesn't fire when the mouse is moved, the user will be required to interact with the page enough to trigger this event. If it is critical to keep the server synced with the page, ajax invocations will be required more often than this event will create. You don't have to necessarily invoke a noop action on the server side, setting the event type is enough.
Another possibility is to use ajax events when the type of interactions occur that indicate your users are actively using the page. For instance, typing a long message in a text area or filtering a large data table.
<p:ajax event="filter" listener="#{bean.activeListener}"/>
Either way, the goal is to keep the server aware that the user is indeed active without flooding the server with unneeded ajax events.

JSF Primefaces mobile confirmation dialog not working

I am trying to add confirmation dialog in a dialog using primefaces mobile. I have tried these examples
<p:dialog id="main">
<h:form>
<p:growl id="messages" />
<p:commandButton value="Delete" onclick="confirmation.show()" type="button"/>
<p:confirmDialog message="Are you sure?" header="Confirmation" severity="alert" widgetVar="confirmation">
<p:commandButton value="Yes" update="messages" oncomplete="confirmation.hide()"
actionListener="#{buttonBean.destroyWorld}" />
<p:commandButton value="Not" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
</h:form>
</dialog>
When i am rendering the page the confirmation dialog is not rendered as dialog also the command buttons are listed.
When i keep confirm dialog in another form, its not invoking the dialog.
JSF
JavaScript
I cannot get either of them to work. What am I doing wrong?

Ajax not working on a jsf 2.2 simple page

I have a simple jsf 2.2 page and cant figure out why ajax is not working, i searched the web but couldnt find a solution, i'm only showing the relevant part here... these are inside a multpart/form-data form. Nothing happens, the outputText is not shown on page when i toggle the selectBooleanCheckBox.
<h:selectBooleanCheckbox value="#{worksheetEditBean.sendMail}"><h:outputLabel value="Send Email"/>
<f:ajax event="change" render="mailPnl" execute="#this"/>
</h:selectBooleanCheckbox>
<h:panelGroup id="mailPnl">
<h:outputText rendered="#{worksheetEditBean.sendMail}">Hello</h:outputText>
</h:panelGroup>

JSF f:ajax prompt before any action

How I can show dialog before any f:ajax action.
I have code as following:
<h:commandButton value="Create Project" styleClass="greyishBtn submitForm" action="#{projectController.delete}">
<f:ajax execute="#form" onevent="function(data) {createProjectEventHandler(data);}" render=":tblProject txtNewProjectName txtNewProjectStartDate taNewProjectDesc"/>
</h:commandButton>
This code works fine, but I need a confirm dialog before call delete action, I tried onevent, but it only have begin, success and complete events, what I need is confirm dialog before 'begin' event.
Any idea?
Thanks in advance.
Before the ajax even starts you can cancel it (ajax) or the submit action itself by using onclick="return false" in the <h:commandButton itself...
So the simplest way it to use js confirm("Delete?") dialog with onclick
<h:commandButton onclick="return confirm('Delete?');" value="Create Project" styleClass="greyishBtn submitForm" action="#{projectController.delete}">
<f:ajax execute="#form" onevent="function(data) {createProjectEventHandler(data);}" render=":tblProject txtNewProjectName txtNewProjectStartDate taNewProjectDesc"/>
</h:commandButton>
A more advanced way could be found here jQuery UI confirm dialog not returns true/false it uses jQuery dialog with JSF

How to prevent reload of page in Richfaces on action/event?

I am using JSF2.0 and RichFaces 4.0.1 Final. I want to prevent the reload of page on occurence of event.
My use case is: There is a Command button with hidden style. I need to invoke the event attached to it in certain case from Javascript.
Problem: Though I am able to invoke the hidden button, the issue is, the moment it gets invoked, the page is getting reloaded. I want to prevent this reload.
Just use ajax:
<h:commandButton id="foo" action="#{bean.foo}" styleClass="hide">
<f:ajax />
</h:commandButton>
Or, since you're already using RichFaces:
<a4j:commandButton id="foo" action="#{bean.foo}" styleClass="hide" />

Resources