Domanda

Being inspired with the article considering the dynamic table rendering (thank you BalusC), I've finally got the exact result I wanted before here a bit earlier. That gave quite perfect results since I could control the behavior of a every single column respecting the business logic requirements. But that was pretty cool if that table was a part of an experimental "static" page where I was making some dynamic binding experiments.

Once I had to merge the ideas to the existing code (more or less stupid knowing nothing about the dynamic expressions), I've got face to face with the following problem: the dynamic binding seems to work only once during the load of the page. Ok, I thought that I was missing to separate the dynamic binding bean and the "main" page bean (controlling user actions like clicking the tree nodes by a user).

A simplified instance of my current page piece is as follows (consider you have a tree at the left and when you click a tree node, you have to get quite another data table [PrimeFaces used]):

a tree, table selector (works pretty perfect)

<p:tree value="#{tableViewsPageBean.root}" var="node" dynamic="true" cache="false"
        selectionMode="single" selection="#{tableViewsPageBean.selectedNode}">
    <p:ajax event="select" listener="#{tableViewsPageBean.onNodeSelect}" update=":form:scene"/>
    <p:treeNode id="treeNode">
        <h:outputText value="#{node}"/>
    </p:treeNode>
</p:tree>

a table that's intented to be dynamically rendered once a user clicks a tree node above

<h:panelGroup id="scene">
    ...
    <h:panelGroup binding="#{dynamicDataTableBean.dataTableGroup}"/>
</h:panelGroup>

The tableViewsPageBean is defined as a @ViewScoped bean, and the dynamicDataTableBean is a @RequestScoped bean (I should not think that it might help -- I just had an idea).

But, for me, the following code is requested only once during the page load:

public HtmlPanelGroup getDataTableGroup() { ... }

I don't know, but is it possible to force this code execution to rebind the component in the panel group mentioned above without page reload? Thanks in advance.

È stato utile?

Soluzione

Sorry, my bad. I had the following in my web.xml:

<context-param>
    <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
    <param-value>false</param-value>
</context-param>

That option must be set to true. However, then I still have the problem described here.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top