Skip to content

Sorting

Sorting allows you to sort data in ascending or descending order.

This function is available:

Sorting can be enabled in two ways:

Info

Sorting won't function until the page is refreshed after adding or updating records.

How does it look?

sorting.gif

On the field

Live Sample · GitHub

How to add?

Example

Step 1 Add sort-enabled-default = false in application.yml

If the parameter is not set to true, sorting must be enabled explicitly at the field level.

    cxbox:
       widget:
           fields: 
                sort-enabled-default: false

Step 2 Add fields.enableSort to corresponding FieldMetaBuilder.

    @Override
    public void buildIndependentMeta(FieldsMeta<InputSortDTO> fields, InnerBcDescription bcDescription, Long parentId) {
        if (configuration.getForceActiveEnabled()) {
            fields.setForceActive(InputSortDTO_.customField);
        }
        fields.enableSort(InputSortDTO_.customField);
    }

At the application level

Not recommended.

If the parameter is set to true, sorting is enabled by default for all fields in the application.

How to add?

Example

Add sort-enabled-default in application.yml

  cxbox:
     widget:
         fields: 
              sort-enabled-default: true