[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Get Started with DevExpress Reporting
 [Expand]Create Popular Reports
 [Collapse]Detailed Guide to DevExpress Reporting
   Introduction to Banded Reports
  [Expand]Provide Data to Reports
  [Expand]Use Report Controls
  [Expand]Shape Report Data
   Lay out Dynamic Report Contents
  [Expand]Customize Appearance
  [Expand]Add Navigation
  [Collapse]Provide Interactivity
    Create Drill-Down Reports
    Sort a Report in Print Preview
    Content Editing in Print Preview
    Print Preview Mouse Events
    Create Drill-Through Reports
    Obtain a Label's Text in Print Preview
  [Expand]Add Extra Information
  [Expand]Merge Reports
  [Expand]Use Expressions
  [Expand]Store and Distribute Reports
  [Expand]Reporting API
 [Expand]Visual Studio Report Designer
 [Expand]Create End-User Reporting Applications
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Sort a Report in Print Preview

This tutorial illustrates how to enable sorting report data in Print Preview without writing any code.

In this tutorial, we will start with the following report displaying products grouped by category names.

You can implement interactive sorting for both the detail data and report groups.

Tip

The created report is platform-agnostic and its interactive features are supported by the Print Preview available for all application platforms.

Expanded Sort Report Groups

To enable sorting report groups in Print Preview, select the label displaying product category names located in the Group Header and switch to the Properties window.

Expand the label's XRLabel.InteractiveSorting property, and set the SortingOptions.TargetBand property to GroupHeader1 and SortingOptions.FieldName to CategoryName.

Switch to the Preview tab to sort report groups by the CategoryName field. When a mouse pointer hovers over the category name, it changes to a hand indicating the sorting capability. The arrow displayed at the element's right edge indicates the sorting order.

Expanded Sort Detail Data

To enable sorting data in the Detail band, select the table cell displaying the Product Name title and switch to the Properties window.

Set the SortingOptions.TargetBand property to Detail and access the SortField property.

In the invoked collection editor, add a new group field and set its GroupField.FieldName to ProductName.

Set the SortingOptions.FieldName property of the table cell to the ProductName field.

On switching to the Preview tab, you can now sort data in the Detail band by the ProductName field.

If you provide interactive sorting to multiple fields, clicking another field clears all the previously applied data sorting. Hold the SHIFT key while clicking to preserve the existing sorting settings and thus sort against multiple fields.

To disable data sorting against a specific field, hold the CTRL key on its caption click.

Note

Reports embedded into the current report using the XRSubreport control do not support interactive data sorting.

Is this topic helpful?​​​​​​​