-
1. Re: How to reRender selection after sorting ?
ilya_shaikovsky Jan 19, 2010 11:35 AM (in response to fdegrigny)1 of 1 people found this helpfuldemo sources available in SVN repo.
http://livedemo.exadel.com/richfaces-demo/richfaces/extendedDataTable.jsf - works there.
-
2. Re: How to reRender selection after sorting ?
fdegrigny Jan 20, 2010 8:56 AM (in response to ilya_shaikovsky)Ok, the trick seems to be the use of an ExtendedTableDataModel as value instead of the default items list.
So, I have wrapped my items into a ExtendedTableDataModel like in the example.
But now I got the following exeption when trying to display the row number with
<rich:column id="col_index" >
<h:outputText value="#{pageCtrl.table.rowIndex + 1}" />
</rich:column>java.lang.NullPointerException at org.richfaces.model.ExtendedTableDataModel.getRowIndex(ExtendedTableDataModel.java:206) at org.ajax4jsf.component.UIDataAdaptor.getRowIndex(UIDataAdaptor.java:311) at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at javax.el.BeanELResolver.getValue(BeanELResolver.java:62) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53) at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:73) at org.apache.el.parser.AstValue.getValue(AstValue.java:118) at org.apache.el.parser.AstPlus.getValue(AstPlus.java:38) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186) at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
any ideas ?
-
3. Re: How to reRender selection after sorting ?
fdegrigny Jan 21, 2010 2:46 AM (in response to fdegrigny)I have set the rowIndex manually : dataModel.setRowIndex(-1), so there no longer NPE but this value is never updated.
I still need to display the rowIndex, how I can do that ?
-
4. Re: How to reRender selection after sorting ?
fdegrigny Jan 21, 2010 7:47 AM (in response to fdegrigny)At last, I have manage to do this with a custom method in the request bean, as follow :
public class PageCtrl
{
private HtmlExtendedDataTable table;
private Integer rowIndex;public int getRowIndex()
{
if( rowIndex == null )
{
rowIndex = table.getFirst();
}
else
{
rowIndex = rowIndex + 1;
}
return rowIndex;
}//...
}
<rich:extendedDataTable id="table" value="#{pageCtrl.dataModel}"binding="#{pageCtrl.table}">
<rich:column id="col_index" >
<h:outputText value="#{pageCtrl.rowIndex + 1}" />
</rich:column>...
</rich:extendedDataTabl>