# Sorting And Filtering
URL: https://pro.rv-grid.com/guides/pivot/concepts/sorting-filtering/
Source: src/content/docs/guides/pivot/concepts/sorting-filtering.mdx
Description: Learn what sorting and filtering affect in Pivot output and how client-side and remote/server-side behavior differ.
Sorting and filtering in Pivot operate on analytical members and generated measures, not on the final rendered cells alone. The same ideas exist in both client-side and server-side Pivot, but the execution layer is different.

## Client-Side Sorting

Client-side Pivot uses dimension metadata when generating row and column members.

Relevant dimension options:

- `sortable`
- `order`

If a Pivot column dimension is marked sortable, generated members for that dimension are ordered using the configured comparer and sort direction.

## Client-Side Filtering

Generated value columns inherit configured filter metadata from their dimensions, so the resulting grid can expose filter-ready columns. This is still based on the generated Pivot output, not on the raw fact table semantics of a remote analytical engine.

## What Actually Gets Sorted

In client mode:

- row hierarchy ordering comes from the grouped source data
- column hierarchy ordering comes from the configured dimension metadata
- measure cells are results of aggregation, not independently sorted records

## Server-Side Sorting And Filtering

In server mode:

- filter expressions are part of `PivotLoadRequest.loadOptions.filter`
- sort directives are part of `PivotLoadRequest.loadOptions.sort`
- the analytical engine is responsible for applying them before returning the visible window

That distinction matters because server-side Pivot should sort and filter the cube window, not just the already-rendered grid cells.

## Sort By Summary

The remote request contract also supports sort-by-summary semantics through `bySummary` on sort descriptors. Use that when your backend can rank groups by a measure rather than only by a dimension label.

## Best Practices

- Keep client-side sorting expectations simple: it orders generated members, not facts.
- Use remote/server-side filtering for large datasets or security-sensitive selectors.
- Do not rely on client-generated columns as the trust boundary for secure filtering. The field registry belongs on the server side.

## Next

Continue with [Plugin Lifecycle](/guides/pivot/plugin-lifecycle/) to see how Pivot owns and restores grid state.
