Skip to main content

PivotGridControl.GetRowIndex(Object[], PivotGridField) Method

Returns the index of the specified row.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.XtraPivotGrid.v24.1.dll

NuGet Package: DevExpress.Win.PivotGrid

Declaration

public int GetRowIndex(
    object[] values,
    PivotGridField field
)

Parameters

Name Type Description
values Object[]

An array of row field values that identify a row.

field PivotGridField

A PivotGridField object that is the Data Field whose values are displayed in the row.

Returns

Type Description
Int32

An integer value that specifies the row index. -1 if the specified row has not been not found.

Remarks

Pivot Grid rows are indexed as shown below:

GetRowIndex

There are two data fields and the Area option is set to the RowArea value. The field value array identifies two rows and you have to specify a data field to get a distinct index.

The following table demonstrates how to get row indices.

C# Visual Basic Return Value
pivotGridControl.GetRowIndex(new object[] {“Beverages”, “Chang”}, fieldQuantity) pivotGridControl.GetRowIndex(New Object() {“Beverages”, “Chang”}, fieldQuantity) 0
pivotGridControl.GetRowIndex(new object[] {“Beverages”, “Chang”}, fieldExtendedPrice) pivotGridControl.GetRowIndex(New Object() {“Beverages”, “Chang”}, fieldExtendedPrice) 1
pivotGridControl.GetRowIndex(new object[] {“Beverages”}, fieldQuantity); pivotGridControl.GetRowIndex(New Object() {“Beverages”}, fieldQuantity) 4
pivotGridControl.GetRowIndex(new object[] {}, fieldQuantity); pivotGridControl.GetRowIndex(New Object() {}, fieldQuantity) 13

Note that the the method requires the field values, which may be different from the displayed text. The grand total columns has null values.

Tip

To display field values instead of automatically created and formatted strings, handle the FieldValueDisplayText event.

See Also