I've been struggling to set global="false" as the attribute of ajax on primefaces that makes ajaxStatus skips this component, however I've handled column filtering event and resize,reorder also sorting, Yet couldn't find any suitable ajax event name to set global to false for datatable pagination buttons/selects events.
On the primefaces datatable
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
Filter reorder, resize, filter and sort events :
<p:ajax event="colReorder" listener="#{dyna.onColumnReorder}" global="false" />-->
<p:ajax event="colResize" listener="#{dyna.onColumnResize}" update=":center_form:tabexam" global="false"/>
<p:ajax event="filter" global="false"/>
<p:ajax event="sort" global="false"/>
What i need now is the pagination event name, i hope that i made my self clear, also a link to all primefaces ajax event names, would be highly appreciated.
I don't believe there is an event for pagination.
Refer to : http://www.primefaces.org/documentation download which ever version but there is a section called Ajax Behaviour Events - page 154 in 4.0.
Page 134 shows all the attributes you can set on the p:datatable
Done.
Using :
<p:ajax event="page" global="false"/>
Related
I'm working with JSF 2.2 (MyFaces) and Primefaces 5. The disabled attribute of p:ajax component in a p:datatable doesn't work.
<p:dataTable id="transactionListTable"
value="#{cardsTransactionsList}"
var="transaction"
selectionMode="single"
rowExpandMode="single" >
<p:ajax event="rowSelect"
disabled="#{condition}"
listener="#{cardTransactionsListCBean.onRowSelect}"
update=":cardsForm:transactionListTable" />
If disabled has value true the ajax call is not disabled. I want disable the row expansion feature when condition is true. Some idea, please? Bye.
In my JSF application if I refresh the page everything get's rendered exceted the primeface graphicimages and jsf <f:ajax /> isn't working. If I wait 5 seconds the ajax calls are working again and graphicimages are getting loaded.
Another example is when I upload an image. The image get procced, uploaded and the site get's refreshed. After this the image is displayed, but ajax calls won't work after a few seconds after.
The app runs on a JBoss 7.1 with JSF 2.1
Is this a problem with slow hardware or something else. I would be happy with any hints because I don't really know where to look for a solution.
Example:
<p:selectOneRadio id="options" value="#{gameWriter.uploadCover}">
<f:selectItem itemLabel="ja" itemValue="true"/>
<f:selectItem itemLabel="nein" itemValue="false"/>
<f:ajax/>
</p:selectOneRadio>
When you define the f:ajax, try to give the UI components you want to execute and update. Also give the event. If you want process the whole form and update the whole page, you can use #form and #all in the f:ajax.
An example with #form and #all with f:ajax is as follows.
<h:form>
<p:selectOneMenu id="cmb" value="#{investigationItemController.current}" >
<f:selectItem itemLabel="Please select an item" />
<f:selectItems value="#{investigationItemController.items}" var="ii" itemLabel="#{ii.name}" itemValue="#{ii}" />
<f:ajax event="change" execute="#form" render="#all"/>
</p:selectOneMenu>
<h:outputLabel id="lbl" value="#{investigationItemController.current}" />
</h:form>
An example with primefaces ajax command is as follows.
<h:form>
<p:selectOneMenu id="cmb" value="#{investigationItemController.current}" >
<f:selectItem itemLabel="Please select an item" />
<f:selectItems value="#{investigationItemController.items}" var="ii" itemLabel="#{ii.name}" itemValue="#{ii}" />
<p:ajax event="change" process="cmb" update="lbl"/>
</p:selectOneMenu>
<h:outputLabel id="lbl" value="#{investigationItemController.current}" />
</h:form>
We can add more than one or for one UI Component if we want to execute the logic for more than one event.
Events for standard JSF UI component can be taken after removing the 'on' from the list of attributes of the UI component starting with 'on'. For example if JSF UI support onChange as an attribute you can use event="change".
For primefaces UI components, the possible events are listed under Primefaces documentation.
It is essential to correctly select the event in order for a successful ajax response.
I'm using JSF with PrimeFaces to make an application as an assignment for college. I'm struggling to get something working. I'm using PrimeFaces and I have a tabview which contains 5 tabs. In one of those tabs I have a dataTable which has several rows and columns. This all works fine, but the problem is that I want to submit the form without rerendering the (entire page). The thing is, every column in the dataTable has a selectBooleanCheckbox, and when that checkbox is selected, a button should disappear. If it's unselected the button should appear. This works fine with onchange="this.form.submit()" or onclick="this.form.submit()" but it refreshes the entire application, and it causes the first tab to be selected, rather than the one I was at. So I'm looking for a solution to be able to submit and re-render some stuff without refreshing the entire program. This is my code:
<body>
<h:form id="customerForm">
<p:dataTable id="customerlist" var="c" value="#{customerBean.customerList}">
<p:column>
<f:facet name="header">Select</f:facet>
<center>
<p:selectBooleanCheckbox value="#{c.selected}" onchange="this.form.submit()"/>
</center>
</p:column>
</p:dataTable>
<h:commandButton id="testtest" value="test" rendered="#{customerBean.numberSelected() == 0}"/>
</h:form>
</body>
I removed most of the columns for the sake of simplicity. What is the solution to this? I've tried using ajax, but that didn't work
<p:selectBooleanCheckbox value="#{c.selected}">
<f:ajax event="click" execute="#form" render="#none"/>
</p:selectBooleanCheckbox>
Do you really need to submit the whole form? If it's enough that the view is being rerenderd try just to update the form. For that you can use the primefaces ajax event.
<p:selectBooleanCheckbox value="#{c.selected}">
<p:ajax update="#form"/>
</p:selectBooleanCheckbox>
If this does not work, please tell us what "..ajax, didn't work" exactly mean. Is there any POST Request submitted? Is any Action/Setter called?
As soon as you add draggableColumns="true" Filtering textBox is not working properly
and also resizable is not working properly.
<p:dataTable id="dataTable" var="tbl"
value="#{pc_searchJobBean.searchJobVO.jobVOs}"
emptyMessage="#{commonMsg['noResultFound']}"
paginatorPosition="bottom" paginator="true" rows="5"
filteredValue="#{pc_searchJobBean.searchJobVO.filteredVos}">
i have to use draggableColumns and filter both.
is there any solution to this problem?
I want to update the datatable columns (particular columns) dynamically as the data changes in the server it has to reflect in UI through ajax call. How can I achieve this with primeface.
you can use polling mechanism provided by primefaces using p:poll tag.
From Primefaces Documentation:
Poll is an ajax component that has the ability to send periodical ajax
requests and execute listeners on JSF backing beans
<h:form id="form">
<p:dataTable id="tab" ...>
//cols
</p:dataTable>
<p:poll interval="3"
listener="#{counterBean.increment}" update="tab" />
</h:form>