private void HandleValueMouseClick(PivotFieldValueEventArgs e) { PivotGridField[] higherFields = e.GetHigherLevelFields(); object[] higherValues = new object[higherFields.Length]; for (int i = 0; i < higherFields.Length; i++) { higherValues[i] = e.GetHigherLevelFieldValue(higherFields[i]); } pivotGridControl1.BeginUpdate(); PivotArea otherArea = GetOtherArea(e); List <PivotGridField> otherFields = pivotGridControl1.GetFieldsByArea(otherArea); for (int i = 0; i < otherFields.Count; i++) { otherFields[i].SortBySummaryInfo.Field = e.DataField; otherFields[i].SortBySummaryInfo.Conditions.Clear(); for (int j = 0; j < higherFields.Length; j++) { otherFields[i].SortBySummaryInfo.Conditions.Add(new PivotGridFieldSortCondition(higherFields[j], higherValues[j])); } if (e.Field != null && e.Field.Area != PivotArea.DataArea) { otherFields[i].SortBySummaryInfo.Conditions.Add(new PivotGridFieldSortCondition(e.Field, e.Value)); } } pivotGridControl1.EndUpdate(); }
public void InstantiateIn(Control container) { PivotGridFieldValueTemplateContainer c = (PivotGridFieldValueTemplateContainer)container; PivotGridFieldValueHtmlCell cell = c.CreateFieldValue(); PivotFieldValueItem valueItem = c.ValueItem; PivotFieldValueEventArgs helperArgs = new PivotFieldValueEventArgs(valueItem); PivotGridField[] fields = helperArgs.GetHigherLevelFields(); List <object> fieldValues = new List <object>(); foreach (PivotGridField field in fields) { object currentValue = helperArgs.GetHigherLevelFieldValue(field); if (currentValue != null) { fieldValues.Add(currentValue); } } cell.Controls.AddAt(cell.Controls.IndexOf(cell.TextControl), new MyLink(c.Text, fieldValues)); cell.Controls.Remove(cell.TextControl); c.Controls.Add(cell); }