Skip to main content
Row

PivotField.UngroupItems(IEnumerable<Int32>) Method

Removes the specified items from grouping.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v24.2.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

void UngroupItems(
    IEnumerable<int> itemIndices
)

Parameters

Name Type Description
itemIndices IEnumerable<Int32>

A list of item indices to remove from grouping.

Example

View Example

Worksheet worksheet = workbook.Worksheets["Report11"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Access the pivot table by its name in the collection
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Access the "State" field by its name in the collection.
PivotField field = pivotTable.Fields["State"];
// Add the "State" field to the column axis area.
pivotTable.ColumnFields.Add(field);

// Group the first three items in the field.
IEnumerable<int> items = new List<int>() { 0, 1, 2 };
field.GroupItems(items);
// Access the created grouped field by its index in the field collection.
int groupedFieldIndex = pivotTable.Fields.Count - 1;
PivotField groupedField = pivotTable.Fields[groupedFieldIndex];
// Set the grouped item caption to "West".
groupedField.Items[0].Caption = "West";

// Group the remaining field items.
items = new List<int>() { 3, 4, 5 };
field.GroupItems(items);
// Set the grouped item caption to "Midwest"
groupedField.Items[1].Caption = "Midwest";

// Ungroup the "West" item.
items = new List<int> { 0 };
groupedField.UngroupItems(items);

The following code snippets (auto-collected from DevExpress Examples) contain references to the UngroupItems(IEnumerable<Int32>) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also