XPTable.Models.Table.Sort C# (CSharp) Method

Sort() public method

Sorts the last sorted column opposite to its current sort order, or sorts the currently focused column in ascending order if no columns have been sorted
public Sort ( bool stable ) : void
stable bool Specifies whether a stable sorting method /// should be used to sort the column
return void
        public void Sort(bool stable)
        {
            // don't allow sorting if we're being used as a
            // preview table in a ColumnModel editor
            if (this.Preview)
            {
                return;
            }

            // if we don't have a sorted column already, check if
            // we can use the column of the cell that has focus
            if (!this.IsValidColumn(this.lastSortedColumn))
            {
                if (this.IsValidColumn(this.focusedCell.Column))
                {
                    this.lastSortedColumn = this.focusedCell.Column;
                }
            }

            // make sure the last sorted column exists
            if (this.IsValidColumn(this.lastSortedColumn))
            {
                // don't bother if the column won't let us sort
                if (!this.ColumnModel.Columns[this.lastSortedColumn].Sortable)
                {
                    return;
                }

                // work out which direction we should sort
                SortOrder newOrder = SortOrder.Ascending;

                Column column = this.ColumnModel.Columns[this.lastSortedColumn];

                if (column.SortOrder == SortOrder.Ascending)
                {
                    newOrder = SortOrder.Descending;
                }

                this.Sort(this.lastSortedColumn, column, newOrder, stable);
            }
        }

Same methods

Table::Sort ( ) : void
Table::Sort ( int column ) : void
Table::Sort ( int index, Column column, SortOrder sortOrder, bool stable ) : void
Table::Sort ( int column, SortOrder sortOrder ) : void
Table::Sort ( int column, SortOrder sortOrder, bool stable ) : void
Table::Sort ( int column, bool stable ) : void
Table