We have a strange behavior with the datatable & filters, we are using internaly a custom ListModel with some additional data.
If we load our datatable and select lines, sort columns, no issues at all.
But when we first do a filter on one column, the value type of the datatable is modified and is never restored.
As far as i can see it seems related to the FilterFeature that calls setValue with an ArrayList type instead of the original model.
End of FilterFeature.filter():
Code: Select all
//save filtered data
table.setFilteredValue(filtered);
table.setValue(filtered);
table.setRowIndex(-1); //reset datamodel
DataModel:
Code: Select all
public class TableModel<E>
extends
ListDataModel<E>
implements
Serializable
{
public TableModel(List<E> datasource)
{
super(datasource);
}
}
Code: Select all
<p:dataTable id="cars" var="car"
value="#{tableController.dataModelSingle}"
rowKey="#{car.model}" sortBy="#{car.manufacturer}"
binding="#{tableController.table}"
widgetVar="carsEdition">
...
</dataTable >
But when filter is used the first time we can see using the binding attribute that the value type as changed.
Logs showing the value type, on page first load, then on sort, and finaly after a filter:
Code: Select all
16:37:10,379 ERROR [stderr] class com.test.TableModel
16:37:13,940 ERROR [stderr] class com.test.TableModel
16:37:19,922 ERROR [stderr] class java.util.ArrayList
Wish the use case is clear,
Thanks