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

Sort() public method

Sorts the specified column in the specified sort direction
public Sort ( int column, SortOrder sortOrder, bool stable ) : void
column int The index of the column to sort
sortOrder SortOrder The direction the column is to be sorted
stable bool Specifies whether a stable sorting method /// should be used to sort the column
return void
        public void Sort(int column, SortOrder sortOrder, bool stable)
        {
            // don't allow sorting if we're being used as a
            // preview table in a ColumnModel editor
            if (this.Preview)
            {
                return;
            }

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

                // if we already have a different sorted column, set
                // its sort order to none
                if (column != this.lastSortedColumn)
                {
                    if (this.IsValidColumn(this.lastSortedColumn))
                    {
                        this.ColumnModel.Columns[this.lastSortedColumn].InternalSortOrder = SortOrder.None;
                    }
                }

                this.lastSortedColumn = column;

                this.Sort(column, this.ColumnModel.Columns[column], sortOrder, stable);
            }
        }

Same methods

Table::Sort ( ) : void
Table::Sort ( bool stable ) : 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, bool stable ) : void
Table