I have an issue with JSF rendering. I am using richfaces 3.3 and spring.
I have a parent screen where we can select rows and then clieck on a a4j:command button.
This in turn opens a modal panel and shows some detail. The modal panel has a data table which is rendered by using the binding attribute as the details in this table are dynamic.
My issue here is the required data never comes up in the modal panel data table in the first button click. When I click the button second time then I can view the data.
I tried to debug, and found that the data table setter method is called first (meaning the model tree is getting renedered) before the action method is called (which actually updated the binding attribute).
How can I force the flow to call the action method first before rendering the jsf tree component?
Your problem is that the modal panel "show" function does exactly what its name says and no more. It does not build and show a panel, it only shows it. The panel was built when the page was loaded, and the show/hide functions only affect whether it is visible or not.
So what you need to do is a partial page update that brings the desired values into the panel. I don't have the details, but they should go something like this:
1. Define a commandButton or commandLink on the row you want to pop up for.
2. Define a backing bean property that is itself a bean that contains the row item values. This can be the actual tableModel row item. However, you CANNOT directly reference the table row in your modal panel, since the rendering of the rows is done at a different time and place and the modal panel has no access to the "current row" directly.
3. Here's where the magic occurs.
a. Define an action method on the control in #1. This action will take the dataTable model's current row and assign its values to the property in #2 where the modal panel can then reference it.
b. Tell the control #1 to reRender the contents of the modal panel.
If I haven't missed anything, that should do it. The action should fire, the modal panel's contents should update, and then the panel should pop up.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jul 05, 2011
Thanks Tim for the reply.
We have the similar changes as suggested by you, but still the issue persists.
Following is the case.
I have a screen where data is displyayed, each row having a check box.
I can select one or more rows and click on a button (this button is part of the tool bar).
The thing here is the content of Modal panel is a dynamic tables being populated by using the binding attribute.
Please suggest if there are any other options. Let me know if you need more details.
The fact that the table in the modal panel is dynamic and bound doesn't change things. However, you do have to invoke reRender properly (make sure you capitalize reRender correctly!). Also, it can be a little tricky in some cases to re-render hidden components. Sometimes it works better to re-render a parent.
A very likely suspect, however, is that you may not be providing the proper ID to reRender. The modal panel should be an independent form outside of the form containing the non-panel table, since forms cannot be nested. So to be able to locate the table inside the form, you may need to either provide a more complete ID (reRender="form1:popupPanel:table1") or use the RichFaces findComponent() EL method to resolve the true ID of the table that needs to be re-rendered.
Joined: Jul 05, 2011
Thanks Tim for the reply,
The data was getting re-rendered with the change suggested but the column header was not getting refreshed. So, we changed the dynamic table to fixed table.