-
1. Re: dataTable not updating?!
konstantin.mishin Dec 8, 2010 10:27 AM (in response to eoin81)Post your java code. Seems you are using request scoped bean instead of session scoped.
-
2. Re: dataTable not updating?!
eoin81 Dec 9, 2010 12:21 PM (in response to konstantin.mishin)Hi Mishin, Thanks for the reply. I've been trying a slightly different approach but with the same results.
My bean is defined in a flow level xml file, which is managed by spring. (its not defined anywhere else)
<bean id="action" class="com.foo.test.MyAction"/>
<CODE>
public class MyAction {
public List<Form> getTestRecords(){
List<Form> forms = new ArrayList<Form>();
Form newForm1 = new Form();
Form newForm2 = new Form();
newForm1.setName("John");
newForm1.setAge(23);
newForm2.setName("Mary");
newForm2.setAge("25");
forms.add(newForm1);
forms.add(newForm2);
return forms;
}
}
[/CODE]
I then use webflow to hold the result of the getRecords method like follows:
<evaluate expression ="action.getRecords()" result="flowScope.forms" />
Then I use RichFaces to display the data (which it does, its just the sorting/filtering that doesent do anything)
<rich:dataTable rows="1" value="${flowScope.forms}" var="items" reRender="ds" id="dt">
...
</rich:dataTable>
Any ideas? Do I need to register my bean somewhere else?
Cheers! Eoin
-
3. Re: dataTable not updating?!
konstantin.mishin Dec 9, 2010 1:06 PM (in response to eoin81)Seems it isn't RichFaces problem. But you could share maven or eclipse project with this problem somewhere and we maybe will investigate it.
-
4. Re: dataTable not updating?!
eoin81 Dec 9, 2010 3:08 PM (in response to konstantin.mishin)Thanks. I'll see what I can do,
What I wanted to be clear of is:
1) For <rich:dataTable/> the backing bean data type that is bound to the value attribute in the tag can be of type java.util.List for displaying/sorting/filtering
2) The definition of my bean is correct. ie do I need to add anything like scope to the bean declaration or do I need to declare it as a managed bean in faces-config, but I dont think I do!
-
5. Re: dataTable not updating?!
eoin81 Dec 14, 2010 4:42 AM (in response to eoin81)I managed to get this working to a certain extent using a custom filtye (thanks to the example from the livedemo site).
I have a dataTable populated with my data from a session scoped managed bean. All works fine.
My filter:
<rich:column filterExpression="#{fn:containsIgnoreCase(items.assetAddress, bean.currentNameFilterValue)}">
<f:facet name="header">
<h:selectOneMenu value="#{bean.currentNameFilterValue}">
<f:selectItems value="#{bean.types}" />
<a4j:support event="onchange" reRender="dt" />
</h:selectOneMenu>
</f:facet>
<h:outputText id="id2" value="#{items.assetAddress}"/>
</rich:column>My problem now is that when I select an element from the drop down (for example A), a request is fired but the table is not updated. If I then select another element from the drop down (for example B), the request is fired but the table is updated for A. Then next selection, the table is updated for B etc ...! So it seems the first request does not satisfy the expression, but it sets the value in the bean, and so the next request satisfies the condition.
I wonder if this is a simple fix? Anyone any ideas?
-
6. Re: dataTable not updating?!
eoin81 Dec 14, 2010 6:44 AM (in response to eoin81)Just an update on this for anyone working with in this area (Webflow + RichFaces)
I needed to add a global transition to my webflow xml to rerender the page in the above scenario, (because there seemed to be some issues with the initial refresh).
xhtml page
...
<a4j:support event="onChange" action="#{bean.action}" reRender="dt">
....
bean
String action(){
//do processing
return "success"
}
flow xml
<view-state id="currentPage">
<transition on="success" to"currentPage"/>
</view-state>
That works!