Skip to main content
A newer version of this page is available. .

PivotCustomFieldValueCellsEventArgs.Split(Boolean, Predicate<FieldValueCell>, Boolean, IList<FieldValueSplitData>) Method

Splits all field value cells that match the specified condition, or only the first matching cell.

Namespace: DevExpress.Web.ASPxPivotGrid

Assembly: DevExpress.Web.ASPxPivotGrid.v18.2.dll

Declaration

public void Split(
    bool isColumn,
    Predicate<FieldValueCell> match,
    bool firstCellOnly,
    IList<FieldValueSplitData> cells
)

Parameters

Name Type Description
isColumn Boolean

true to process column field value cells; false to process row field value cells.

match Predicate<FieldValueCell>

A System.Predicate that represents the condition used to define which cells should be split.

firstCellOnly Boolean

true to split only the first cell that matches the specified condition; false to split all cells that match the condition.

cells IList<FieldValueSplitData>

A list of FieldValueSplitData objects that define how to split the cells.

Remarks

The Split method cannot split a field value cell if it has only one nested cell, or has none.

To split a cell (or several cells), create a System.Predicate<FieldValueCell> delegate that defines which cells should be split, and pass it as the match parameter. You should also create a list of FieldValueSplitData objects. Each of them identifies a single new cell, from the leftmost to the rightmost (for the column cells), or from the topmost to the bottommost (for the row cells). Specify the size and values of the new cells using the FieldValueSplitData.NestedCellCount and FieldValueSplitData.Value properties, respectively, and pass the list as the cells parameter. The FieldValueSplitData.NestedCellCount property defines the size of a newly created cell by specifying the number of cells nested in it.

pivotgrid_SplitData

Example

The following example demonstrates how to split field value cells. In this example, the Grand Total column header is split into two cells: Price and Count. To do this, the CustomFieldValueCellsevent is handled, and the event parameter’s Split method is used. Cells that should be split are identified by a predicate that returns true for those cells. The quantity, size and captions of newly created cells are specified by an array of cell definitions (the FieldValueSplitData objects).

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
    Inherits="ASPxPivotGrid_SplittingCells._Default" %>
<%@ Register Assembly="DevExpress.Web.ASPxPivotGrid.v10.2, Version=10.2.0.0,
    Culture=neutral, PublicKeyToken=79868b8147b5eae4"
    Namespace="DevExpress.Web.ASPxPivotGrid"
    TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:RadioButtonList ID="radioButtonList" runat="server"
            AutoPostBack="true" CellSpacing="10" >
            <asp:ListItem Selected="True">Default Layout</asp:ListItem>
            <asp:ListItem>Split Grand Total Column Header</asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <div>
            <dx:ASPxPivotGrid ID="pivotGrid" runat="server" Width="500px" 
                OnFieldValueDisplayText="pivotGrid_FieldValueDisplayText"
                OnCustomFieldValueCells="pivotGrid_CustomFieldValueCells"
                OptionsCustomization-AllowFilter="False"
                OptionsCustomization-AllowDrag="False">
            </dx:ASPxPivotGrid>
        </div>
    </form>    
</body>

</html>
See Also