Class Sorter.SortData

java.lang.Object
com.flowlogix.jeedao.primefaces.Sorter.SortData
Enclosing interface:
Sorter<TT>

public static class Sorter.SortData extends Object
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 Details

  • Method Details

    • applicationSort

      public void applicationSort(String fieldName, 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 the lowest sort order
      Parameters:
      fieldName - element to be replaced or added
      fp - 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 added
      highPriority - integer (starting with zero, highest priority) where this sort directive is put into the array, only if it's inserted, and not modified
      fp - lambda to get the application sort criteria