public override void ViewDidLoad() { base.ViewDidLoad(); SetupViews(); _sortedColumn = new SortedColumn(0, ZMJSorting.ZMJAscending); _data = File.ReadAllLines("data.tsv", Encoding.UTF8) .Select(r => r.Split('\t')) .ToList(); _header = _data.First(); _data.RemoveAt(0); }
public void DidSelectItemAt(SpreadsheetView spreadsheetView, NSIndexPath indexPath) { if (indexPath.Row != 0) { return; } if (_sortedColumn.Column == indexPath.GetColumn()) { SortedColumn sc = _sortedColumn; sc.Sorting = _sortedColumn.Sorting == ZMJSorting.ZMJAscending ? ZMJSorting.ZMJDsescending : ZMJSorting.ZMJAscending; _sortedColumn = sc; } else { _sortedColumn = new SortedColumn((int)indexPath.GetColumn(), ZMJSorting.ZMJAscending); } if (_sortedColumn.Sorting == ZMJSorting.ZMJAscending) { _data = _data .OrderBy(r => r[_sortedColumn.Column]) .ToList(); } else { _data = _data .OrderByDescending(r => r[_sortedColumn.Column]) .ToList(); } spreadsheetView.ReloadData(); }