public static void csSetDevViewSortSeq(this GridView view, string colName, ColumnSortOrder columnSortOrder) { var temp = new List <GridColumnSortInfo>() { new GridColumnSortInfo(view.Columns[colName], columnSortOrder) } .ToArray(); view.SortInfo.ClearAndAddRange(temp); }
public void Should_Return_Identifier(ColumnSortOrder sortOrder) { // Given // When var result = sortOrder.ToShortString(); // Then result.ShouldNotBeNullOrWhiteSpace(); }
public void Should_Not_Fail_On_Report_Creation(ColumnSortOrder value) { // Given var fixture = new GenericIssueReportFixture(GenericIssueReportTemplate.HtmlDxDataGrid); // When / Then fixture.TestReportCreation( settings => settings.WithOption(HtmlDxDataGridOption.MessageSortOrder, value)); }
private SortingDirection GetSortingDirection(ColumnSortOrder sortOrder) { switch (sortOrder) { case ColumnSortOrder.Descending: return(SortingDirection.Descending); default: return(SortingDirection.Ascending); } }
/// <summary> /// Returns the short identifier of the sort order. /// </summary> /// <param name="sortOrder">Sort order for which the identifier should be returned.</param> /// <returns>Short identifier of the sort order.</returns> public static string ToShortString(this ColumnSortOrder sortOrder) { switch (sortOrder) { case ColumnSortOrder.Ascending: return("asc"); case ColumnSortOrder.Descending: return("desc"); default: throw new ArgumentException("Unknown enumeration value", nameof(sortOrder)); } }
private static void DrawCustomSortedShape(GraphicsCache cache, Rectangle r, ColumnSortOrder so, ImageCollection imCol) { //Draw a custom image for the sort glyph if (so == ColumnSortOrder.None) { return; } int i = 0; if (so == ColumnSortOrder.Descending) { i = 1; } cache.Paint.DrawImageUnscaled(cache.Graphics, imCol.Images[i], new Point(r.X, r.Y)); }
private void drawCustomSortedShape(Graphics g, Rectangle r, ColumnSortOrder so, ImageList iml) { //Draw a custom image for the sort glyph if (so == ColumnSortOrder.None) { return; } int i = 0; if (so == ColumnSortOrder.Descending) { i = 1; } g.DrawImageUnscaled(iml.Images[i], r.X + (r.Width - iml.ImageSize.Width) / 2, r.Y + (r.Height - iml.ImageSize.Height) / 2); }
public void SaveChanges() { view.BeginSort(); view.ClearSorting(); foreach (TreeListNode node in sortTree.Nodes) { GridColumn column = node["Column"] as GridColumn; if (column == null) { continue; } ColumnSortMode sortMode = (ColumnSortMode)node["SortOn"]; ColumnSortOrder sortOrder = (ColumnSortOrder)node["SortOrder"]; column.SortMode = sortMode; column.SortOrder = sortOrder; } view.EndSort(); }
private void OrderGridView_CustomColumnSort(object sender, CustomColumnSortEventArgs e) { e.Handled = true; if (e.Column.FieldName != "ShowCustomerDetail" && (_sortColumn != e.Column.FieldName || _sortColumn == e.Column.FieldName && _sortDirection != e.SortOrder) ) { if (_sortColumn != e.Column.FieldName) { _sortDirection = ColumnSortOrder.Ascending; } else if (_sortColumn == e.Column.FieldName && _sortDirection != e.SortOrder) { _sortDirection = e.SortOrder; } _sortColumn = e.Column.FieldName; _loadingRecords = true; LoadGridRecords(); } }
public GroupingInfo(string name, ColumnSortOrder sortOrder, DateGranularity dateGranularity, string sortAggregate) { throw new global::System.NotImplementedException("GroupingInfo"); }
public void setSortOrder(ColumnSortOrder sortOrder) { throw new global::System.NotImplementedException("GroupingInfo.SetSortOrder"); }
public static IQueryable ApplySorting(this IQueryable query, string fieldName, ColumnSortOrder order) { return(query.MakeOrderBy(Converter, new ServerModeOrderDescriptor(new OperandProperty(fieldName), order == ColumnSortOrder.Descending))); }
public TopRows(int rowLimit, ColumnSortOrder direction) { throw new global::System.NotImplementedException("TopRows"); }
//================================================================================================================ //================================================================================================================ #endregion // PopupForms #region GridViews //================================================================================================================ //================================================================================================================ public static void GridView_AddColumn(GridViewSettings gridSettings, MVCxGridViewColumnType colType, string fieldName, string colCaption, HorizontalAlign colAlignment, Unit colWidth, string colFormat, ColumnSortOrder colSortOrder) //================================================================================================================ // This routine generates code to add a column to a DevExpress grid // // Parameters // gridSettings: Reference to a grid view settings object // colType: Data type of the column // fieldName: Name of the model property this field is linked to // colCaption: Column title // colAlignment: Horizontal Alignment // colWidth: Column width // colFormat: Column format string // colSortOrder: Column sort order //================================================================================================================ { gridSettings.Columns.Add(column => { column.FieldName = fieldName; column.Caption = colCaption; column.HeaderStyle.HorizontalAlign = HorizontalAlign.Center; column.ColumnType = colType; column.PropertiesEdit.DisplayFormatString = colFormat; column.CellStyle.HorizontalAlign = colAlignment; column.Width = colWidth; column.SortIndex = 1; column.SortOrder = colSortOrder; }); }
private void SortData(ColumnBase column, ColumnSortOrder order) { Model.RefreshMessages(column.Tag as string, order == ColumnSortOrder.Ascending); }
/// <summary> /// Orders the columns in a DataTable by the given ordering method. /// </summary> /// <param name="table">The table whose columns should be sorted.</param> /// <param name="columnSortOrder">The order by which the columns should be sorted.</param> /// <param name="view">The Epi Info 7 form</param> public static void OrderColumns(DataTable table, ColumnSortOrder columnSortOrder, View view = null) { #region Input Validation if (table == null) { throw new ArgumentNullException("table"); } #endregion // Input Validation if (columnSortOrder == ColumnSortOrder.None) { return; } bool isUsingEpiProject = (view == null); bool sortByTabOrder = (columnSortOrder == ColumnSortOrder.TabOrder); if (!sortByTabOrder || !isUsingEpiProject) { // alphabetical sort List <string> columnNames = new List <string>(); foreach (DataColumn dc in table.Columns) { columnNames.Add(dc.ColumnName); } columnNames.Sort(); if (columnNames.Contains("UniqueKey")) { columnNames.Remove("UniqueKey"); columnNames.Add("UniqueKey"); } else if (columnNames.Contains("UNIQUEKEY")) { columnNames.Remove("UNIQUEKEY"); columnNames.Add("UNIQUEKEY"); } for (int i = 0; i < columnNames.Count; i++) { string columnName = columnNames[i]; table.Columns[columnName].SetOrdinal(i); } } else if (sortByTabOrder && isUsingEpiProject) { // tab order sort Dictionary <string, int> columnNames = new Dictionary <string, int>(); int runningTabIndex = 0; foreach (Page page in view.Pages) { SortedDictionary <double, string> fieldsOnPage = new SortedDictionary <double, string>(); foreach (Epi.Fields.Field field in page.Fields) { if (field is Epi.Fields.RenderableField && field is Epi.Fields.IDataField) { Epi.Fields.RenderableField renderableField = field as Epi.Fields.RenderableField; if (renderableField != null) { double tabIndex = renderableField.TabIndex; while (fieldsOnPage.ContainsKey(tabIndex)) { tabIndex = tabIndex + 0.1; } fieldsOnPage.Add(tabIndex, field.Name); } } } foreach (KeyValuePair <double, string> kvp in fieldsOnPage) { columnNames.Add(kvp.Value, runningTabIndex); runningTabIndex++; } } if (columnNames.ContainsKey("UniqueKey")) { columnNames["UniqueKey"] = runningTabIndex + 1; } else if (columnNames.ContainsKey("UNIQUEKEY")) { columnNames["UNIQUEKEY"] = runningTabIndex + 1; } else { columnNames.Add("UNIQUEKEY", runningTabIndex + 1); } int newRunningTabIndex = 0; // to prevent arg exceptions; TODO: Fix this better foreach (KeyValuePair <string, int> kvp in columnNames) { if (table.Columns.Contains(kvp.Key)) { table.Columns[kvp.Key].SetOrdinal(newRunningTabIndex); newRunningTabIndex++; } } } }
/// <summary> /// Orders the columns in a DataTable by the given ordering method. /// </summary> /// <param name="table">The table whose columns should be sorted.</param> /// <param name="columnSortOrder">The order by which the columns should be sorted.</param> /// <param name="view">The Epi Info 7 form</param> public static void OrderColumns(DataTable table, ColumnSortOrder columnSortOrder, View view = null) { #region Input Validation if (table == null) { throw new ArgumentNullException("table"); } #endregion // Input Validation if (columnSortOrder == ColumnSortOrder.None) { return; } bool isUsingEpiProject = (view == null); bool sortByTabOrder = (columnSortOrder == ColumnSortOrder.TabOrder); if (!sortByTabOrder || !isUsingEpiProject) { // alphabetical sort List<string> columnNames = new List<string>(); foreach (DataColumn dc in table.Columns) { columnNames.Add(dc.ColumnName); } columnNames.Sort(); if (columnNames.Contains("UniqueKey")) { columnNames.Remove("UniqueKey"); columnNames.Add("UniqueKey"); } else if (columnNames.Contains("UNIQUEKEY")) { columnNames.Remove("UNIQUEKEY"); columnNames.Add("UNIQUEKEY"); } for (int i = 0; i < columnNames.Count; i++) { string columnName = columnNames[i]; table.Columns[columnName].SetOrdinal(i); } } else if (sortByTabOrder && isUsingEpiProject) { // tab order sort Dictionary<string, int> columnNames = new Dictionary<string, int>(); int runningTabIndex = 0; foreach (Page page in view.Pages) { SortedDictionary<double, string> fieldsOnPage = new SortedDictionary<double, string>(); foreach (Epi.Fields.Field field in page.Fields) { if (field is Epi.Fields.RenderableField && field is Epi.Fields.IDataField) { Epi.Fields.RenderableField renderableField = field as Epi.Fields.RenderableField; if (renderableField != null) { double tabIndex = renderableField.TabIndex; while (fieldsOnPage.ContainsKey(tabIndex)) { tabIndex = tabIndex + 0.1; } fieldsOnPage.Add(tabIndex, field.Name); } } } foreach (KeyValuePair<double, string> kvp in fieldsOnPage) { columnNames.Add(kvp.Value, runningTabIndex); runningTabIndex++; } } if (columnNames.ContainsKey("UniqueKey")) { columnNames["UniqueKey"] = runningTabIndex + 1; } else if (columnNames.ContainsKey("UNIQUEKEY")) { columnNames["UNIQUEKEY"] = runningTabIndex + 1; } else { columnNames.Add("UNIQUEKEY", runningTabIndex + 1); } int newRunningTabIndex = 0; // to prevent arg exceptions; TODO: Fix this better foreach (KeyValuePair<string, int> kvp in columnNames) { if (table.Columns.Contains(kvp.Key)) { table.Columns[kvp.Key].SetOrdinal(newRunningTabIndex); newRunningTabIndex++; } } } }
protected void ASPxGridView1_BeforeGetCallbackResult(object sender, EventArgs e) { ASPxGridView1.GroupSummarySortInfo[0].SortOrder = SavedUnitsSortOrder = GetStateSortOrder(); }
public static IEnumerable <GridViewGroupInfo> GetGroupInfo(this IQueryable query, string fieldName, ColumnSortOrder order) { var rowType = query.ElementType; query = query.MakeGroupBy(Converter, new OperandProperty(fieldName)); query = query.MakeOrderBy(Converter, new ServerModeOrderDescriptor(new OperandProperty("Key"), order == ColumnSortOrder.Descending)); query = ApplyExpression(query, rowType, "Key", "Count"); var list = new List <GridViewGroupInfo>(); foreach (var item in query) { var obj = (object[])item; list.Add(new GridViewGroupInfo() { KeyValue = obj[0], DataRowCount = (int)obj[1] }); } return(list); }
public SortColumn(string sortColumn, ColumnSortOrder sortOrder) { throw new global::System.NotImplementedException("SortColumn"); }
//public static void SetDevViewSortSeq(GridView view, string colName, ColumnSortOrder columnSortOrder) //{ // csSetDevViewSortSeq(view, colName, columnSortOrder); //} public static void csSetDevViewSortSeq(this GridControl grid, string colName, ColumnSortOrder columnSortOrder) { var temp = (GridView)grid.DefaultView; temp.csSetDevViewSortSeq(colName, columnSortOrder); }
public static IEnumerable <GridViewGroupInfo> GetGroupInfo(this IQueryable query, string fieldName, ColumnSortOrder order) { var rowType = query.ElementType; query = query.MakeGroupBy(Converter, new OperandProperty(fieldName)); query = query.MakeOrderBy(Converter, new ServerModeOrderDescriptor(new OperandProperty("Key"), order == ColumnSortOrder.Descending)); var param = Expression.Parameter(query.ElementType, string.Empty); var keyValues = query.ApplyExpression(Expression.Property(param, "Key"), param).ToArray(); var dataRowCounts = query.ApplyExpression(Expression.Call(typeof(Enumerable), "Count", new Type[] { rowType }, param), param).ToArray(); var list = new List <GridViewGroupInfo>(); for (int i = 0; i < keyValues.Length; i++) { list.Add(new GridViewGroupInfo() { KeyValue = keyValues[i], DataRowCount = (int)dataRowCounts[i] }); } return(list); }
protected void SortBy(string fieldName, ColumnSortOrder order) { Columns.First(c => c.FieldName == fieldName).SortOrder = order; }
public SortField(string _name, ColumnSortOrder _sortOrder) { Name = _name; SortOrder = _sortOrder; }
public ColumnSortOrder SortBy(GridViewColumn column, ColumnSortOrder value) { return(this.HostedASPxGridView.SortBy(column, value)); }
public void setDirection(ColumnSortOrder direction) { throw new global::System.NotImplementedException("TopRows.SetDirection"); }