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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:15:25+00:00 2026-06-03T05:15:25+00:00

Finally I’ve managed how to build a true dynamic table with the DOM -like

  • 0

Finally I’ve managed how to build a true dynamic table with the DOM-like approach in JSF when the data table structure is defined according to an external source. ( DataTable with dynamic columns exactly what I need) Basically, the following code is quite enough for me:

<p:layoutUnit position="west">
    <!-- 2 -->
    <p:tree value="#{tableViewsPageBean.root}" var="node" dynamic="true" cache="false"
                                        selectionMode="single" selection="#{tableViewsPageBean.selectedNode}">
        <!-- 3 -->
        <p:ajax event="select" listener="#{tableViewsPageBean.onNodeSelect}"/>
        <p:treeNode id="treeNode">
            <h:outputText value="#{node}"/>
        </p:treeNode>
    </p:tree>
</p:layoutUnit>
<p:layoutUnit position="center">
    <h:panelGroup>
        <h:panelGroup rendered="#{tableViewsPageBean.isRegeneratable}">
            <p:commandButton value="#{fu:$(languageBean, 'REGENERATE')}"
                             action="#{dynamicTableViewBean.regenerate}"/>
        </h:panelGroup>
        <!-- 1 -->
        <h:panelGroup binding="#{dynamicTableViewBean.dataTableGroup}"/> 
    </h:panelGroup>
</p:layoutUnit>

But there is a problem I currently do not know how to solve. If you take a look at the code above, you can see the numeric markers in the comments that represent the flow of the backing beans methods:

  1. binding="#{dynamicTableViewBean.dataTableGroup}"
  2. selection="#{tableViewsPageBean.selectedNode}"
  3. listener="#{tableViewsPageBean.onNodeSelect}"

This order is not good for me, because the binding of the h:panelGroup must be defined after a user changed the selection in the tree view. Simply saying, the very best flow would be:

  1. selection="#{tableViewsPageBean.selectedNode}" (previously 2)
  2. listener="#{tableViewsPageBean.onNodeSelect}" (previously 3)
  3. binding="#{dynamicTableViewBean.dataTableGroup}" (previously 1)

so I could build a data table component respecting the user selection in the tree. So is it a way to force another order of executing the methods above? PrimeFaces version used: 3.2

Thanks in advance. Your help is appreciated a lot.

  • 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-03T05:15:26+00:00Added an answer on June 3, 2026 at 5:15 am

    It worked that way in old JSF 1.x on JSP, but not anymore in JSF 2.x on Facelets. But the invocation order should not matter. Just make the binding getter/setter a normal getter/setter and manipulate the dataTableGroup inside the listener method instead. It’s after all the same object reference.

    public void onNodeSelect(NodeSelectEvent event) {
        dataTableGroup.getChildren().add(...);
        // ...
    }
    

    You only need to add the update attribute to <p:ajax> in order to really update the bound panelgroup or one of its parents when the ajax request completes, otherwise you will effectively see no change in the view.

    E.g.

    <h:form id="formId">
        ....
        <p:ajax event="select" listener="#{tableViewsPageBean.onNodeSelect}" update=":formId:groupId" />
        ...
        <h:panelGroup id="groupId" binding="#{dynamicTableViewBean.dataTableGroup}"/> 
        ...
    </h:form>
    

    By the way, are you aware of PrimeFaces’ <p:columns> component? It may be a better solution if all you want is dynamic columns. That solution didn’t exist in flavor of any UIComponent back in the dark JSF 1.x ages, that’s why the awkward binding workaround was been applied.

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

Sidebar

Related Questions

I finally managed to connect VBA and a telnet-like terminal. Now I need to
Finally I managed to get pylucene working on my windows7 machine, Which raised a
I finally managed to get an object out of an AsyncTask (DogAsyncTask) with an
I finally have this working now but would like to know how I can
UPDATE Finally managed to work it out! Thanks for all the help from everyone.
I finally managed to trim my code and put all the TableViewController-Methods in a
I finally wrote a script to get Google Analytics data then insert it into
* Update: * Finally I find the problem. The problem is like this: pair<int,int>
I finally managed to change the background of a textview widget in pygtk. Turns
Finally reached data migration part of my Project and now trying to move data

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.