Skip to content

Commit

Permalink
Allow to sort by an arbitrary set of columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mnieto committed Jul 19, 2016
1 parent f5d487d commit b93afc2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ListComparer/DataList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ public class DataList {
/// </summary>
public void Sort() {
DataView dv = Data.DefaultView;
//TODO: Allow to sort by an arbitrary set of columns
dv.Sort = Data.Columns[0].ColumnName;
var keyNames = FillOptions.Columns.Where(x => x.IsKey).Select(x => x.Name);
dv.Sort = string.Join(", ", keyNames);
if (dv.Sort == string.Empty)
dv.Sort = Data.Columns[0].ColumnName;
Data = dv.ToTable();
}

Expand Down

0 comments on commit b93afc2

Please sign in to comment.