public Sort ( int column, bool stable ) : void | ||
column | int | The index of the column to sort |
stable | bool | Specifies whether a stable sorting method /// should be used to sort the column |
return | void |
public void Sort(int column, 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;
// work out which direction we should sort
SortOrder newOrder = SortOrder.Ascending;
Column col = this.ColumnModel.Columns[column];
if (col.SortOrder == SortOrder.Ascending)
{
newOrder = SortOrder.Descending;
}
this.Sort(column, col, newOrder, stable);
}
}
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, SortOrder sortOrder, bool stable ) : void |