Chciałbym zresetować filtrowanie, sortowanie i stan stronicowania tabeli danych PrimeFaces. Niestety nie ma łatwego sposobu na zrobienie tego. Zwłaszcza usunięcie stanu sortowania jest trudne.Resetowanie stanu PrimeFaces DataTable (filtrowanie, sortowanie, stronicowanie)
co zrobiłem do tej pory to:
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent(componentId);
if (dataTable != null) {
dataTable.setSortOrder("ascending"); // reset sortOrder
dataTable.setFirst(0); // reset page
dataTable.setFilteredValue(null); // reset filter
dataTable.setFilters(null);
}
Używam PrimeFaces 3.4.1.
Mogę potwierdzić, że z Primefaces 5.3 dataTable.setValueExpression ("SortBy", null) i dataTable.setSortBy (null); razem wygenerował DataTable, który nie ma sortowania wskazane w nagłówkach kolumn. – alfonx