I'm having trouble finding an ajax event that will execute my javascript when my list is updated during lazy loading of my datatable. This javascript is responsible for updating an image coverflow based upon my list that gets repopulated during initial datatable loading, when doing pagination, and changing the number of records on a page. Any help with finding a way to make an event execute my javascript during these situations is greatly appreciated! Thanks in advance!
Primefaces 3.3.1
Mojarra 2.1.5
JBoss AS 7.1.0.Final
Its not specific for Lazy Loading :
In order to run a js function upon pagination complete use the p:ajax event="page" (It might also work for changing the number of records on a page)
Like this
<p:ajax event="page" oncomplete="myJsFunction();"></p:ajax>
Additional event types are
page - On pagination.
sort - When a column is sorted.
filter - On filtering.
rowSelect - When a row is being selected.
rowUnselect - When a row is being unselected.
rowEdit - When a row is edited.
rowEditCancel - When row edit is cancelled.
colResize - When a column is being selected.
toggleSelect - When header checkbox is toggled.
colReorder - When columns are reordered.
rowSelectRadio - Row selection with radio.
rowSelectCheckbox - Row selection with checkbox.
rowUnselectCheckbox - Row unselection with checkbox.
rowDblselect - Row selection with double click.
rowToggle - Row expand or collapse.
contextMenu - ContextMenu display.
(Taken from primefaces user guide)
In primefaces 6.2, here is the full list of dataTable events.
page
sort
filter
rowSelect
rowUnselect
rowEdit
rowEditInit
rowEditCancel
colResize
toggleSelect
colReorder
contextMenu
rowSelectRadio
rowSelectCheckbox
rowUnselectCheckbox
rowDblselect
rowToggle
cellEditInit
cellEdit
rowReorder
swipeleft
swiperight
tap
taphold
cellEditCancel
from the docs: javax.faces.component.behavior.ClientBehaviorHolder.getEventNames()
Related
Is there any ajax event available for datatable as columnEdit in primefaces. I want to edit the datatable column when i press the any symbol(edit icon or checkbox or radio button) in the column header.Is there any way to do that.
I am making datatable in JSF using (dataTable tag).
I am having several rows in that with check box( selectBooleanCheckbox ) in front of every record.
I have commandLink button for selecting all check box and deselected all check box..
i am trying to select/unselect all checkboxes in the datatable using a single commandLink. As I am trying to set it on the server, I am unable to do so. I have looked around for solutions but could not get how to accomplish on the server side.
thnks
How can I make the Primefaces p:dataTable selection Enable or Disable or Multiple or Single dynamically based on some condition.
There is disabledSelection attribute of p:dataTable in PrimeFaces 5+. Using this attribute with proper data table update, enable/disable row selection can be reached.
I am implementing a datatable and would like to limit the user to only be allowed to expand one datatable row at a time. If a user goes to expand a second row when another row is already expanded it will collapse the first row before expanding the second. Is this possible using primefaces? I am currently using Primefaces Version 3.0
PrimeFaces is just about to release an enhancement that adds a "rowToggle" event to their row expansion component. It should be in the next release after 3.3.1. It will allow you to handle the row toggle event. Once you have the ability to handle the toggle event, you will be able to write code that will collapse all rows other than the current toggled row. See here: https://code.google.com/p/primefaces/issues/detail?id=2277 which states that it will be included in the next deployment.
Note that they've already added an example of this new event to their showcase labs: http://www.primefaces.org/showcase-labs/ui/datatableExpandableRows.jsf, so it should be forthcoming.
Alternatively, you can leverage the "onExpandStart" attribute of <p:dataTable> to invoke client side code (Javascript) to collapse any rows which are in an expanded state.
I have been trying to call a custom listener when the cancel button is clicked in the primefaces rowEditor component. But I am not able to find the correct attribute to do this.
The problem with the cancel button is that it works fine when the row is already present in the dataTable, if I try to add a new row dynamically to the dataTable and click on the cancel button [ if I think that it is not required ], the empty row is shown in the dataTable, when the empty row should be deleted.
Would you please help me out ?
Try like (JSF2 + Primefaces 2.2.1) ...
<p:column headerText="Test">
<p:rowEditor>
<p:ajaxStatus oncomplete="#{yourBean.yourHandleMethod()}"></p:ajaxStatus>
</p:rowEditor>
</p:column>
I am afraid this functionality isn't available out of box. The rowEditor component has built in integration to a dataTable and its own events and listeners for editing a single existing row. The cancel button of the rowEditor component has the sole functionality of toggling the output and input facets of the Primefaces column components.
If you are good at jQuery you may be able to hack the functionality in by finding the DOM element by the cancel button class, jQuery('.ui-icon-close') and assigning a custom javascript event listener but this could be problematic in a dataTable where there are multiple rows and it sounds as if you would like to delete a blank row if Cancel is selected.
A better approach is create an Add New button that displays a dialog with a form. Submitting through the form in the dialog can add the necessary row to your dataTable.