The issue may manifest if aggregate descriptions are added on the pivot`s column axis and if their member does not return data.
How to reproduce: check the attached project and screenshots, the correct items are shown in screenshot correct-items-calculated-field.jpg Workaround: public partial class Form1 : Form { private LocalDataSourceProvider provider; public Form1() { InitializeComponent(); //Setup pivot and add calculated field //Workaround this.radPivotFieldList1.ValuesControl.CreatingVisualListItem += ValuesControl_CreatingVisualListItem; } private void ValuesControl_CreatingVisualListItem(object sender, CreatingVisualListItemEventArgs args) { args.VisualItem = new MyPivotFieldListVisualItem(this.radPivotFieldList1.ViewModel); } } public class MyPivotFieldListVisualItem : PivotFieldListVisualItem { FieldListViewModel viewModel; public MyPivotFieldListVisualItem(FieldListViewModel viewModel) : base(viewModel) { this.viewModel = viewModel; } protected override void UpdateContextMenu() { base.UpdateContextMenu(); PivotFieldListItemButton button = (PivotFieldListItemButton)typeof(PivotFieldListVisualItem).GetField("button", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(this); string providerName = this.viewModel.DataProvider != null ? this.viewModel.DataProvider.GetType().FullName : String.Empty; if (this.Data == null) { return; } if (this.Data.DataBoundItem is Value && !(providerName.Contains("Xmla") || providerName.Contains("Adomd"))) { for (int i = 0; i < 5; i++) { button.Items.RemoveAt(i); } } } }
The best solution would be to have cells in Excel with the correct data type and formatted values. This can be achieved with an additional property similar to RadGridView. At the moment data cells which are created from aggregate descriptions with an applied StringFormat property are exported as text and they do not persist the formatting which is not correct. A possible workaround is to set the ExportVisualSettings property of the PivotGridSpreadExport object to true so that the formatting event to fire. Then in the CellFormatting event one can set the FormatString this way: private void SpreadExport_CellFormatting(object sender, PivotGridSpreadExportCellFormattingEventArgs e) { if (e.Cell.Text.StartsWith("$")) { e.Cell.FormatString = "$ #.00"; } else if (e.Cell.Text.Contains("€")) { e.Cell.FormatString = "#.00 €"; } } PivotGridSpreadExportCellFormattingEventArgs, however, does not provide information about the actual aggregate of the data cell, so the applied number format on the aggregate cannot be obtained in the formatting event.
How to reproduce: check the attached project and select an item from the drop-down list
The new API would allow some of the default functions to be removed and custom aggregate functions to be added. At the moment the dialog can be modified like this: Public Class MyAggregateOptionsDialog Inherits AggregateOptionsDialog Private availableAggregateFunctions As IList(Of AggregateFunction) = New List(Of AggregateFunction)() From { AggregateFunctions.Sum, AggregateFunctions.Count, AggregateFunctions.Average, AggregateFunctions.Max, AggregateFunctions.Min, AggregateFunctions.Product, AggregateFunctions.StdDev, AggregateFunctions.StdDevP, AggregateFunctions.Var, AggregateFunctions.VarP, New SqrtSumAggregateFunction() } Public Overrides Sub LoadSettings(aggregateDescription As PropertyAggregateDescriptionBase) MyBase.LoadSettings(aggregateDescription) Dim listAggregateFunctions = DirectCast(Me.GetType().BaseType.GetField("listAggregateFunctions", BindingFlags.NonPublic Or BindingFlags.Instance).GetValue(Me), RadListControl) listAggregateFunctions.DataSource = availableAggregateFunctions End Sub End Class
To reproduce: Try setting the value in the CellForamting event. Workaround: class MySpreadExportRenderer : SpreadExportRenderer { public override void SetCellSelectionValue(DataType dataType, object value) { base.SetCellSelectionValue(dataType, value); if (dataType == DataType.Number) { CellRange range = ((CellSelection)this.GetCellSelection()).CellRanges.ElementAtOrDefault(0); double d; if (double.TryParse(Convert.ToString(value), out d)) { var cell = ((Worksheet)this.GetWorksheet()).Cells[range.FromIndex.RowIndex, range.FromIndex.ColumnIndex]; cell.SetFormat(new CellValueFormat("#,##0.00")); cell.SetValue(d); } } } }
Workaround: public Form1() { InitializeComponent(); this.radPivotGrid1.GroupDescriptorElementCreating += radPivotGrid1_GroupDescriptorElementCreating; } private void radPivotGrid1_GroupDescriptorElementCreating(object sender, Telerik.WinControls.UI.GroupDescriptorElementCreatingEventArgs e) { FieldInfo fi = e.GroupDescriptorElement.GetType().GetField("filterPopup", BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); fi.SetValue(e.GroupDescriptorElement, new MyPivotGroupFilterPopup(e.GroupDescriptorElement) { Visible = false }); e.GroupDescriptorElement.SortDirectionArrow.Visibility = ElementVisibility.Collapsed; } public class MyPivotGroupFilterPopup : PivotGroupFilterPopup { public MyPivotGroupFilterPopup(PivotGroupDescriptorElement pivotGroupDescriptorElement) : base(pivotGroupDescriptorElement) { } protected override void LoadSettings() { base.LoadSettings(); this.Items.Remove(SortAZMenuItem); this.Items.Remove(SortZAMenuItem); this.Items.Remove(SortOptionsMenuItem); } }
Need to have the ability to resize the height of the aggregate area along with other features that will help the user see/discern the labels properly
Request is to have the ability preferably using a mouse drag to change the height of the column headers in the grid. We can already do that for data rows of the grid, but it is not possible currently to do the same for the header row.
Workaround: remove the localization provider before saving the layout and then add it back.
Workaround: If possible add the label filters with code PropertyGroupDescription dateGroupDescription = new PropertyGroupDescription(); dateGroupDescription.PropertyName = "Date"; LabelGroupFilter filter = new LabelGroupFilter(); ComparisonCondition condition = new ComparisonCondition { Condition = Telerik.Pivot.Core.Filtering.Comparison.IsGreaterThan, Than = new DateTime(2010, 6, 6) }; filter.Condition = condition; dateGroupDescription.GroupFilter = filter; this.provider.RowGroupDescriptions.Add(dateGroupDescription);
Hour, minute, second, if possible also week
How to reproduce: check the attached video Workaround: private void button1_Click(object sender, EventArgs e) { this.radPivotFieldList1.DragDropService.PreviewDragDrop += DragDropService_PreviewDragDrop; } IGroupDescription cache; string group; private void DragDropService_PreviewDragDrop(object sender, Telerik.WinControls.RadDropEventArgs e) { TreeNodeElement nodeElement = e.DragInstance as TreeNodeElement; if (nodeElement != null) { IField field = nodeElement.Data.DataBoundItem as IField; string draggedItem = field.FieldInfo.Name; IGroupDescription rowDesc = this.radPivotGrid1.RowGroupDescriptions.Where(i => i.GetUniqueName() == draggedItem).FirstOrDefault(); if (rowDesc != null) { cache = (IGroupDescription)rowDesc.Clone(); group = "Row"; } IGroupDescription colDesc = this.radPivotGrid1.ColumnGroupDescriptions.Where(i => i.GetUniqueName() == draggedItem).FirstOrDefault(); if (colDesc != null) { cache = (IGroupDescription)colDesc.Clone(); group = "Column"; } if (cache != null) { this.radPivotGrid1.UpdateCompleted += radPivotGrid1_UpdateCompleted; } } } private void radPivotGrid1_UpdateCompleted(object sender, EventArgs e) { this.radPivotGrid1.UpdateCompleted -= radPivotGrid1_UpdateCompleted; switch (group) { case "Row": this.radPivotGrid1.RowGroupDescriptions.Add(cache); break; case "Column": this.radPivotGrid1.ColumnGroupDescriptions.Add(cache); break; default: break; } cache = null; }