Cell Editors Overview

  • 3 minutes to read

Pivot Grid Control cells do not support data editing by default, and only display summary values calculated against data fields. You can customize cell text by formatting values or dynamically handling the PivotGridControl.CustomCellDisplayText event.

In specific instances, you may need to change the way cell contents are presented on-screen (for instance, use progress bars to display values). You may also want to allow an end-user to modify cell contents by embedding in-place editors.

NOTE

When an end-user edits a cell's value, the changes are not automatically saved to the underlying data source. You need to save these changes manually by handling the PivotGridControl.EditValueChanged event. Otherwise, the changes are lost once the cell loses focus.

Cell Editors Overview

You can assign in-place editors to cells to:

  1. replace cell values in display mode (when editing is inactive);
  2. allow an end-user to edit cells.

Pivot Grid Control cells can embed editors from the XtraEditors Library (descendants of the BaseEdit class). These include: ButtonEdit, DateEdit, CalcEdit, ProgressBarControl, LookUpEdit, etc.

The image below shows a sample PivotGridControl with different editors assigned to data fields. The CalcEdit and ProgressBarControl controls are used for in-place editing within cells corresponding to the first and second data fields (Extended Price and Percent of Column).

Cell Editors

NOTE

Third-party editors cannot be embedded into cells.

Providing In-place Editors

Follow the steps below to assign in-place editors to cells:

  1. Create a repository item - a RepositoryItem class descendant that stores properties and events related to a specific editor. It contains all the information required for creating an editor.
  2. Add this item to the EditorContainer.RepositoryItems collection that contains editors the current control can use.
  3. Assign the created repository item to the PivotGrid control using one of the approaches below.

The editor binding methods can be used in various combinations. This means you can provide editors for a data field and then override editor assignments for the particular cells of this field.

See Preventing Editors from Being Activated to learn how to prevent end-users from activating editors.

Saving Changes

When an end-user edits a cell's value, the changes are not automatically saved to the underlying data source. You need to save these changes manually by handling the PivotGridControl.EditValueChanged event. Otherwise, the changes are lost once the cell loses focus.

See Also