Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8070387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:23:21+00:00 2026-06-05T13:23:21+00:00

In a JSF 2.1 + PrimeFaces 3.2 web application, I need to trigger a

  • 0

In a JSF 2.1 + PrimeFaces 3.2 web application, I need to trigger a JavaScript function after a p:dataTable is loaded. I know that there is no such event in this component, so I have to find a workaround.

In order to better understand the scenario, on page load the dataTable is not rendered. It is rendered 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, I have a JavaScript hook after the successful login, if it can be of any help. The update attribute forces the dataTable’s rendered attribute to revaluate:

<p:dataTable  var="person" value="#{myBean.lazyModel}" rendered="#{p:userPrincipal() != null}" />

After the datatable is loaded, I need to run a JavaScript function on each row item, in order to subscribe to a cometD topic.

In theory I could use the oncomplete attribute of the login Button for triggering a property from myBean in order to retrieve once again the values to be displayed in the dataTable, but it doesn’t seem very elegant.

The JavaScript function should do something with the rowKey of each row of the dataTable:

function javaScriptFunctionToBeTriggered(rowKey) {
    // do something
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T13:23:22+00:00Added an answer on June 5, 2026 at 1:23 pm

    The javascript method from the oncomplete attribute is called after the ajax request has finished and thus after the dataTable is loaded.

    So you can do the following:

    <p:commandButton ... oncomplete="doSomething()"/>
    

    and everything should work fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a datatable using JSF primefaces. I know there is
i am writing a web application with jsf 2.0 and using primefaces framework. i
I am developing a Java web application using Hibernate and JSF/primefaces. am sometimes getting
i am creating a web application using jsf and primefaces, and my question is
I am styling a web application that I made with Java EE (using JSF
I'm developing a web application using Spring, JSF 2 and Primefaces 3. I want
I'm working in a Java EE web application using Hibernate, Spring, JSF and Primefaces.
My JSF web application uses PrimeFaces Captcha. It works properly under Firefox and IE,
There is an existing web application created in Struts. There is a need to
I am trying to deploy a JSF (Primefaces) application in JBOSS 7.1.0. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.