public static void Grid_ClientLayout(object s, ASPxClientLayoutArgs e) { MVCxGridView grid = (MVCxGridView)s; var viewModel = GetModelFromSession(grid); if (e.LayoutMode == ClientLayoutMode.Saving && viewModel != null) { bool bSortChanged = false; foreach (GridViewColumn column in grid.AllColumns) { if (column is MVCxGridViewColumn) { MVCxGridViewColumn MVCcolumn = (MVCxGridViewColumn)column; var col = viewModel.ViewHeader.GetColumnByOriginalName(MVCcolumn.FieldName); if (col != null) { col.IsVisible = MVCcolumn.Visible; if ((!col.SortOrder.HasValue && MVCcolumn.SortIndex != -1) || (col.SortOrder.HasValue && col.SortOrder.Value != MVCcolumn.SortIndex) || (col.SortOrder.HasValue && col.IsSortAscending == (MVCcolumn.SortOrder == ColumnSortOrder.Descending)) ) { bSortChanged = true; } col.SortOrder = MVCcolumn.SortIndex; col.IsSortAscending = !(MVCcolumn.SortOrder == ColumnSortOrder.Descending); col.ColumnFilter = ((GridViewDataColumn)MVCcolumn).FilterExpression; col.ColumnWidth = MVCcolumn.Width.IsEmpty ? AvrView.DefaultFieldWidth : (int)MVCcolumn.Width.Value; } } else if (column is MVCxGridViewBandColumn) { MVCxGridViewBandColumn MVCband = (MVCxGridViewBandColumn)column; var band = viewModel.ViewHeader.GetBandByOriginalName(MVCband.Name); if (band != null) { band.IsVisible = MVCband.Visible; } } } if (bSortChanged) { viewModel.ViewHeader.GetAggregateColumnsList().ForEach(c => AggregateCasheWeb.FillAggregateColumn(viewModel.ViewData, c, viewModel.ViewHeader.GetSortExpression())); } } else { } }
public MVCxGridViewBandColumn(MVCxGridViewBandColumn band) { Band = band; }