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();
        }
        protected void ASPxPivotGrid1_CustomCallback(object sender, PivotGridCustomCallbackEventArgs e)
        {
            ASPxPivotGrid pivot = (ASPxPivotGrid)sender;

            pivot.JSProperties["cpAlertMessage"] = null;
            string[] parameters = e.Parameters.Split(new char[] { '|' });
            if (parameters.Length == 5 && parameters[0] == "MenuItemClick")
            {
                if (parameters[1] == "hideValue")
                {
                    bool isColumn = parameters[4] == "ColumnArea";
                    PivotFieldValueEventArgs fieldValueInfo = pivot.GetFieldValueInfo(isColumn, Convert.ToInt32(parameters[3]));
                    if (isColumn)
                    {
                        pivot.JSProperties["cpAlertMessage"] = string.Format("Cannot hide the {0} column", fieldValueInfo.Value);
                    }
                    else
                    {
                        if (fieldValueInfo.Field != null)
                        {
                            fieldValueInfo.Field.FilterValues.Add(fieldValueInfo.Value);
                        }
                    }
                }
            }
        }
Пример #3
0
        void ApplySortByValue(PivotFieldValueEventArgs valueInfo)
        {
            if (valueInfo.DataField != valueInfo.Field)
            {
                return;
            }
            SortInfo sortInfo = new SortInfo();

            sortInfo.DataField = valueInfo.DataField;
            PivotGridField[] fields = valueInfo.GetHigherLevelFields();
            for (int i = 0; i < fields.Length; i++)
            {
                sortInfo.Conditions.Add(new PivotGridFieldSortCondition(fields[i], valueInfo.GetFieldValue(fields[i], valueInfo.MinIndex)));
            }
            this.sortInfo = sortInfo;
            pivotGridControl1.RefreshData();
        }
Пример #4
0
        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);
        }
 private PivotArea GetOtherArea(PivotFieldValueEventArgs e)
 {
     return(e.IsColumn ? PivotArea.RowArea : PivotArea.ColumnArea);
 }
Пример #6
0
 private void pivotGridControl1_FieldValueCollapsed(object sender, PivotFieldValueEventArgs e)
 {
     TransferData(currentChartDataSourceType);
 }