Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Collapse]Tree List
   [Expand]Product Information
   [Collapse]Feature Center
    [Expand]Data Binding
    [Expand]Nodes
    [Expand]Data Editing
    [Expand]Data Representation
    [Collapse]Sorting
      TreeList Sorting Specifics
      Sorting at Runtime
      Sorting via Code
      Custom Sorting
    [Expand]Filtering
    [Expand]Summaries
    [Expand]Appearances and Look And Feel
    [Expand]Focus, Selection and Navigation
     Formatting Cell Values
    [Expand]Miscellaneous
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End User Capabilities
   [Expand]Member Tables
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

TreeList Sorting Specifics

Expanded Sorting Data Represented as a Tree-Like Structure

Basically, sorting a table's data by the values of a column results in arranging values of the column in either ascending or descending order. This is the standard method of sorting data for controls which display data in a simple tabular form. However, this cannot be implemented in the TreeList control, since in most cases, this may lead to destroying the tree-like data representation. So, the sorting algorithm used by the Tree List differs from the one described above.

Each row of the Tree List control has a nesting level within the tree. Rows are sorted with respect to their nesting levels, in order to preserve the tree-like structure. First, root level rows are sorted by values of a column. Note, that after this has been done, the root level rows are not arranged contiguously. They are separated from each other by their child rows. Immediate child rows of each root node are then sorted (note that each root node's children are sorted separately). This process is repeated for second level rows, and so on, until the entire hierarchy has been sorted. Once sorting is complete, the rows of each nesting level are sorted within their group. (A group is a set of rows having the same parent row).

The image below displays the original data within the Tree List control and its arrangement after sorting by values of a column.

Expanded Sorting Data by Values of Multiple Columns

The Tree List control is capable of sorting data by the values of multiple columns. Let's consider the case when two columns are involved in sorting. When sorting data by values of the first column, data rearrangement occurs as described above. The second column only affects sorting for records belonging to the same group with identical values, within the first column.

The following image displays the changes when the second column affects the sort. The Budget column is initially sorted. However, it contains the identical values within one group.So, including the Location column within the sort changes the order of the affected rows.

Note: sorting by a third column is only necessary when rows from a group contain identical values in the first two sort columns.

How would you rate this topic?​​​​​​​