Working with FlexReport > Sorting Data |
Sorting is another way to organize data in ascending or descending order.
In FlexReport, sorting is achieved by using DataSource.SortDefinitions.
Lets say you want to view the list of employees with their names in ascending order. In this case the list should be sorted by First Name. The following steps illustrate how to sort the names of the list of employees in alphabetical order. This example uses sample created in FlexReport Quick Start.
Dim asc As Boolean = True Private Sub sortC1Button_Click(sender As Object, e As RoutedEventArgs) If asc Then Dim sd As New SortDefinition("[FirstName]", SortDirection.Ascending) rep.DataSource.SortDefinitions.Add(sd) asc = False End If rep.Render() End Sub
bool asc = true; private void sortC1Button_Click(object sender, RoutedEventArgs e) { if (asc) { SortDefinition sd = new SortDefinition("[FirstName]", SortDirection.Ascending); rep.DataSource.SortDefinitions.Add(sd); asc = false; } rep.Render(); }