Class Sorter.SortData
java.lang.Object
com.flowlogix.jeedao.primefaces.Sorter.SortData
Manipulates sort criteria requested from the UI and possibly adds
or replaces it with application-based sort criteria
Example:
@Named
@ViewScoped
public class SortingDataModel implements Serializable {
@Inject
@Getter
JPALazyDataModel<UserEntity> userModel;
@PostConstruct
void initialize() {
// add an ascending zip code-based sort order
userModel.initialize(builder -> builder.sorter((sortData, cb, root) ->
sortData.applicationSort(UserEntity_.zipCode.getName(),
var -> cb.asc(root.get(UserEntity_.zipCode))))
.build());
}
}
- Author:
- lprimak
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Replaces, or adds application sort criteria to the existing UI sort criteria If the sort criteria is new, it is placed at either highest or lowest order, depending on the highPriority parametervoid
Replaces, or adds application sort criteria to the existing UI sort criteria If the sort criteria is new, it is placed at the lowest sort order
-
Constructor Details
-
SortData
-
-
Method Details
-
applicationSort
Replaces, or adds application sort criteria to the existing UI sort criteria If the sort criteria is new, it is placed at the lowest sort order- Parameters:
fieldName
- element to be replaced or addedfp
- lambda to get the application sort criteria
-
applicationSort
public void applicationSort(String fieldName, boolean highPriority, Function<Optional<SortMeta>, Order> fp) Replaces, or adds application sort criteria to the existing UI sort criteria If the sort criteria is new, it is placed at either highest or lowest order, depending on the highPriority parameter- Parameters:
fieldName
- field to be replaced or addedhighPriority
- integer (starting with zero, highest priority) where this sort directive is put into the array, only if it's inserted, and not modifiedfp
- lambda to get the application sort criteria
-