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 3991492
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:37:21+00:00 2026-05-20T06:37:21+00:00

I have a JSF 2 application which uses a Richfaces 4 tree control. The

  • 0

I have a JSF 2 application which uses a Richfaces 4 tree control. The tree is set to use the “AJAX” switch type. On each selection an AJAX call is made to the server to update the selection value of the tree’s backing bean.

On clicking a node there is a delay between the click and the node appearing as selected. The documentation does state that using this method may cause a slight delay, but I wonder why it doesn’t just update the style of the node before issuing the AJAX request, so that the user isn’t left wondering if the click has been registered.

I’ve been trying to figure out a way to update the node on a javascript onclick event, but I don’t see an id on the span that I’d have to change. Has anyone else tried something similar? Am I going to have to find the parent div and work down to the second span? Surely there’s a better way?

Note that using the “client” switch type is not an option, as we need to be able to query for child nodes dynamically. Building the entire tree in one go is not practical in this instance, so it has to be either “server” or “Ajax”.

  • 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-05-20T06:37:22+00:00Added an answer on May 20, 2026 at 6:37 am

    Answering my own question – and contradicting my “no client switching” stipulation a little bit.

    Since we’re using RichFaces 4, I’m able to specify that tree node expansion should use ajax (allowing the tree to be populated “lazily”), and selection should be client-side only. However, we still had a requirement to store the current selection state in the tree’s backing bean. To do so, I added an a4j:jsfunction to the page …

    <a4j:jsFunction name="onSelection">
        <a4j:param name="param1" assignTo="#{treeBean.selectedNodeID}"  />    
    </a4j:jsFunction>
    

    … and called it from the “onmousedown” event on each tree node …

    onmousedown="onSelection('#{node.id}')"
    

    This way the tree updates visually without waiting for the ajax request to complete, and feels a lot snappier to the user.

    The only problem with this seems to be that the onmousedown event is fired when clicking on the toggle as well, so expanding a node causes it to be “selected” without updating its style. Unfortunately “onselected” doesn’t seem to be implemented in the current milestone build.

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

Sidebar

Related Questions

If you have a JSF <h:commandLink> (which uses the onclick event of an <a>
All the tutorials I have seen seem to use *.jsf , *.faces , or
I have created a simple JSF application, now must to connect to SQL Server
I have two web application projects which are related. One is the website itself
In JSF is it possible to have a datatable displays records as follows? [Name
Is there any documentation about introducing jBoss seam to an old Hibernate/JSF project? Have
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
I am building a JSF application. I defined the GUI and did the select
I need to know what's the best method for accessing a JSF managedBean (which

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.