In the JSF 2.1 + PrimeFaces 3.2 web application, I need to run the JavaScript function after loading p:dataTable . I know that there is no such event in this component, so I have to find a workaround.
To better understand the scenario, the dataTable is not displayed when the page loads. It is displayed after a successful login:
<p:commandButton value="Login" update=":aComponentHoldingMyDataTable" action="#{loginBean.login}" oncomplete="handleLoginRequest(xhr, status, args)"/>
As you can see from the above code, after a successful login, I have a JavaScript hook if it can be useful. The update attribute causes the dataTable rendering attribute to overestimate:
<p:dataTable var="person" value="#{myBean.lazyModel}" rendered="#{p:userPrincipal() != null}" />
After loading the datatable, I need to run a JavaScript function for each element of the string in order to subscribe to cometD .
In theory, I could use the oncomplete attribute of the oncomplete button to launch the property from myBean , to get the values ββthat will be displayed in the dataTable again, but that doesn't seem very elegant.
The JavaScript function should do something with the rowKey each row of dataTable:
function javaScriptFunctionToBeTriggered(rowKey) {
source share