Skip to main content

TcxCustomGridTableView.CreateItem Method

Creates an item and adds it to the current View.

Declaration

function CreateItem: TcxCustomGridTableItem;

Returns

Type
TcxCustomGridTableItem

Remarks

Use the CreateItem method to create and add an item to the current View. By default, an item is placed at the end of the item list (the Items property). You can use the CreateColumn and CreateRow methods implemented in (Banded) Table Views and Card Views respectively to create items instead of the CreateItem method.

The DataBinding.ValueTypeClass property determines the type of a value a user can edit within the item. In bound mode, ValueTypeClass is set automatically based on the type of the field to which an item is connected (the DataBinding.FieldName property). In unbound and provider modes, you need to set ValueTypeClass manually.

In unbound mode, ValueTypeClass determines the default editor used to edit the item contents. For instance, assigning it to TcxBooleanValueType results in using the TcxCheckBox editor for the item. Refer to the FieldName property and TcxValueType class topics to learn about the default editors assigned to items in bound and unbound modes.

To explicitly specify an editor for the item, see the item’s RepositoryItem or PropertiesClass properties.

The following code shows how to create an item within the data-aware tvFilms View and connect it to the TAGLINE field from the View’s dataset.

with tvFilms.CreateItem as TcxGridDBColumn do
  begin
    DataBinding.FieldName := 'TAGLINE';
    Width := 150;
    //specify TcxMemo as an in-place editor for the item
    PropertiesClass := TcxMemoProperties;
  end;

In data-aware Views, you can create items for all dataset fields via the CreateAllItems method.

See Also