public bool IsSortSupported(string propertyName) { if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentException("propertyName"); } if (!this.DataTableLoader.Table.Columns.Contains(propertyName)) { return(false); } SortSupportDescription sortSupportDescription = this.SortSupportDescriptions.FirstOrDefault((SortSupportDescription arg) => string.Compare(arg.ColumnName, propertyName, StringComparison.OrdinalIgnoreCase) == 0); if (sortSupportDescription != null) { return(sortSupportDescription.SortMode != SortMode.NotSupported && !string.IsNullOrEmpty(sortSupportDescription.SortedColumnName)); } return(typeof(IComparable).IsAssignableFrom(this.DataTableLoader.Table.Columns[propertyName].DataType)); }
private string CreateSortString(PropertyDescriptor property, ListSortDirection direction) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append('['); string columnName = property.Name; if (this.DataTableLoader.Table.Columns.Contains(columnName)) { SortSupportDescription sortSupportDescription = this.SortSupportDescriptions.FirstOrDefault((SortSupportDescription arg) => string.Compare(arg.ColumnName, columnName, StringComparison.OrdinalIgnoreCase) == 0); if (sortSupportDescription != null && !string.IsNullOrEmpty(sortSupportDescription.SortedColumnName)) { columnName = sortSupportDescription.SortedColumnName; } } stringBuilder.Append(columnName); stringBuilder.Append(']'); if (ListSortDirection.Descending == direction) { stringBuilder.Append(" DESC"); } return(stringBuilder.ToString()); }
private void DetachSort(SortSupportDescription sortSupportDescription) { sortSupportDescription.DataTableLoaderView = null; }
private void AttachSort(SortSupportDescription sortSupportDescription) { sortSupportDescription.DataTableLoaderView = this; }