Calling Primefaces dialog box from Managed Bean function

You can, by using the RequestContext (or PrimeFaces if you are using the version 6.2 or higher) class. Suppose you have the following: <p:dialog id=”myDialogID” widgetVar=”myDialogVar”> …. </p:dialog> So the way you do in the facelet itself, i.e. onclick=myDialogVar.show();, the same can be done in your managed bean like so: For PrimeFaces <= 3.x RequestContext … Read more

Ajax update doesn’t work, when using filter on p:dataTable

After updating datatable you have to invoke it’s client side filter() method. <p:dataTable widgetVar=”dataTableWidgetVar” id=”dataTable” var=”row” value=”#{bean.value}” filteredValue=”#{bean.filteredValue}” paginator=”true” rows=”25″ paginatorPosition=”bottom” rowKey=”${row.id}” editable=”true”> <p:commandButton value=”Save” actionListener=”#{bean.save}” update=”:form” oncomplete=”PF(‘dataTableWidgetVar’).filter()”/> For PrimeFaces versions older than 5, you should use <p:commandButton value=”Save” actionListener=”#{bean.save}” update=”:form” oncomplete=”dataTableWidgetVar.filter()”/>

How to trigger component refresh from javascript in primefaces?

You can use PrimeFaces’ <p:remoteCommand> for this. <p:remoteCommand name=”updateGrowl” update=”showmessage” /> which is to be invoked as <p:commandButton … oncomplete=”addMemberDlg.hide(); updateGrowl();” /> In this particular case there’s however a simpler way. Set the autoUpdate attribute of <p:growl> to true. <p:growl autoUpdate=”true” life=”1500″ id=”showmessage”/> It’ll auto-update itself on every ajax request. If your component actually didn’t … Read more

JSF(Primefaces) ajax update of several elements by ID’s

If the to-be-updated component is not inside the same NamingContainer component (ui:repeat, h:form, h:dataTable, etc), then you need to specify the “absolute” client ID. Prefix with : (the default NamingContainer separator character) to start from root. <p:ajax process=”@this” update=”count :subTotal”/> To be sure, check the client ID of the subTotal component in the generated HTML … Read more

What is the function of @this exactly?

The PrimeFaces process and standard JSF execute attributes should point to spaceseparated component identifiers of components which JSF should process during the entire JSF lifecycle upon an ajax request (get request parameters, validate them, update model, execute action). The process defaults to @form, the current form, and the execute defaults to @this, the current component. … Read more

How to do double-click prevention in JSF

If you’re using solely ajax requests, you could use jsf.ajax.addOnEvent handler of the JSF JavaScript API for this. The below example will apply on all buttons of type=”submit”. function handleDisableButton(data) { if (data.source.type != “submit”) { return; } switch (data.status) { case “begin”: data.source.disabled = true; break; case “complete”: data.source.disabled = false; break; } } … Read more

Email validation using regular expression in JSF 2 / PrimeFaces

All regular expression attempts to validate the email format based on Latin characters are broken. They do not support internationalized domain names which were available since May 2010. Yes, you read it right, non-Latin characters are since then allowed in domain names and thus also email addresses. That are thus extremely a lot of possible … Read more

techhipbettruvabetnorabahisbahis forumu