// Handles the CustomFieldValueCells event to remove columns with
        // zero summary values.
        void pivotGrid_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e)
        {
            if (pivotGrid.DataSource == null)
            {
                return;
            }
            if (rbDefault.IsChecked == true)
            {
                return;
            }

            // Obtains the first encountered column header whose column
            // matches the specified condition, represented by a predicate.
            FieldValueCell cell = e.FindCell(true, new Predicate <object[]>(

                                                 // Defines the predicate returning true for columns
                                                 // that contain only zero summary values.
                                                 delegate(object[] dataCellValues) {
                foreach (object value in dataCellValues)
                {
                    if (!object.Equals((decimal)0, value))
                    {
                        return(false);
                    }
                }
                return(true);
            }));

            // If any column header matches the condition, this column is removed.
            if (cell != null)
            {
                e.Remove(cell);
            }
        }
示例#2
0
        // Handles the CustomFieldValueCells event to remove
        // specific rows.
        void pivotGrid_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e)
        {
            if (pivotGrid.DataSource == null)
            {
                return;
            }
            if (rbDefault.IsChecked == true)
            {
                return;
            }

            // Iterates through all row headers.
            for (int i = e.GetCellCount(false) - 1; i >= 0; i--)
            {
                FieldValueCell cell = e.GetCell(false, i);
                if (cell == null)
                {
                    continue;
                }

                // If the current header corresponds to the "Employee B"
                // field value, and is not the Total Row header,
                // it is removed with all corresponding rows.
                if (object.Equals(cell.Value, "Employee B") &&
                    cell.ValueType != FieldValueType.Total)
                {
                    e.Remove(cell);
                }
            }
        }
示例#3
0
        // Handles the CustomFieldValueCells event to remove
        // specific rows.
        protected void pivotGrid_CustomFieldValueCells(object sender,
                                                       PivotCustomFieldValueCellsEventArgs e)
        {
            PivotGridControl pivot = sender as PivotGridControl;

            if (pivot.DataSource == null)
            {
                return;
            }
            if (radioGroup1.SelectedIndex == 0)
            {
                return;
            }

            // Iterates through all row headers.
            for (int i = e.GetCellCount(false) - 1; i >= 0; i--)
            {
                FieldValueCell cell = e.GetCell(false, i);
                if (cell == null)
                {
                    continue;
                }

                // If the current header corresponds to the "Employee B"
                // field value, and is not the Total Row header,
                // it is removed with all corresponding rows.
                if (object.Equals(cell.Value, "Employee B") &&
                    cell.ValueType != PivotGridValueType.Total)
                {
                    e.Remove(cell);
                }
            }
        }
    public static void ApplyCustomFieldValueCells(PivotCustomFieldValueCellsEventArgs e, PivotGridField dataField)
    {
        bool isColumn   = false;
        int  levelCount = e.GetLevelCount(isColumn);

        for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
        {
            FieldValueCell crossCell = e.GetCell(isColumn, i);
            if (crossCell.EndLevel != levelCount - 1)
            {
                continue;
            }
            for (int j = e.GetCellCount(!isColumn) - 1; j >= 0; j--)
            {
                FieldValueCell cell = e.GetCell(!isColumn, j);
                if (IsCellValid(cell, dataField))
                {
                    object dataCellValue = isColumn ? e.GetCellValue(crossCell.MinIndex, cell.MinIndex) : e.GetCellValue(cell.MinIndex, crossCell.MinIndex);
                    if (object.Equals(dataCellValue, 0m))
                    {
                        e.Remove(crossCell);
                    }
                }
            }
        }
    }
示例#5
0
        private void xrPivotGrid1_CustomFieldValueCells(object sender, DevExpress.XtraReports.UI.PivotGrid.PivotCustomFieldValueCellsEventArgs e)
        {
            bool isColumn = true;

            for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
            {
                FieldValueCell cell = e.GetCell(isColumn, i);
                if (cell != null)
                {
                    e.Remove(cell);
                }
            }
        }
    protected void ASPxPivotGrid1_CustomFieldValueCells(object sender, DevExpress.Web.ASPxPivotGrid.PivotCustomFieldValueCellsEventArgs e)
    {
        bool isColumn = true;

        for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
        {
            FieldValueCell cell = e.GetCell(isColumn, i);
            if (cell != null)
            {
                e.Remove(cell);
            }
        }
    }
示例#7
0
 private void RemoveUnselectedCells(PivotCustomFieldValueCellsEventArgs e, bool isColumn, int minIndex, int maxIndex)
 {
     for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
     {
         FieldValueCell cell = e.GetCell(isColumn, i);
         if (cell == null)
         {
             continue;
         }
         if (minIndex > cell.MaxIndex || maxIndex < cell.MinIndex)
         {
             e.Remove(cell);
         }
     }
 }
    protected void ASPxPivotGrid1_CustomFieldValueCells(object sender, DevExpress.Web.ASPxPivotGrid.PivotCustomFieldValueCellsEventArgs e)
    {
        PivotGridField fieldYear = ASPxPivotGrid1.Fields["fieldOrderYear"];

        if (fieldYear.Area == PivotArea.ColumnArea || fieldYear.Area == PivotArea.RowArea)
        {
            bool isColumn = fieldYear.Area == PivotArea.ColumnArea;
            for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
            {
                FieldValueCell cell = e.GetCell(isColumn, i);
                if (unnecessaryYearTotals.Contains(cell.Value) && cell.ValueType == PivotGridValueType.Total)
                {
                    e.Remove(cell);
                }
            }
        }
    }
示例#9
0
 private void HideEmptyValues(bool isColumn, PivotCustomFieldValueCellsEventArgs e)
 {
     for (int i = e.GetCellCount(isColumn) - 1; i >= 0; i--)
     {
         FieldValueCell cell = e.GetCell(isColumn, i);
         if (cell == null)
         {
             continue;
         }
         if (cell.EndLevel == e.GetLevelCount(isColumn) - 1)
         {
             if (IsValueEmpty(isColumn, cell.MaxIndex, e))
             {
                 e.Remove(cell);
             }
         }
     }
 }
 static bool IsCellValid(FieldValueCell cell, PivotGridField field)
 {
     return(cell.ValueType == PivotGridValueType.GrandTotal && Object.Equals(cell.DataField, field));
 }