The Javascript behaviour can be used to catch events with javascript without making an AJAX request.
In the example, the "page" event is caught with pe:javascript. This will also destroy the paging functionality of p:datatable because no ajax request will be done.
So it should not be used for every event and every component. Following javascript parameters will be available in executes statement:
- source - client Id of the component which fires the event
- event - The name of the catched event
- params - The rendered params (f:param childrens of pe:javascript)
- ext - The object created by corresponding widget
The 'ext' parameter can be used for example to get the parameters which are created by the parent widget.
For example the colResize event of p:dataTable:
var ext = {
params: [
{ name: id + '_columnId', value : columnHeader.attr('id') },
{ name: id + '_width', value : newWidth },
{ name: id + '_height', value : columnHeader.height() }
]
};
id is the client Id of the datatable.
Notice: We can not provided a list with params, for this you should look at the PrimeFaces or PrimeFaces Extensions source.