Skip to main content

TcxCustomDataController.MultiSelect Property

Enables selection of multiple records in a data controller.

Declaration

property MultiSelect: Boolean read; write;

Property Value

Type
Boolean

Remarks

A data controller enables you to select and focus particular rows (data records and grouping rows). There is always one focused row in the data controller which is determined by the FocusedRowIndex property.

There can be only one selected row if the MultiSelect property is set to False — the focused row. In this mode, when you focus a row, it is automatically selected, and the GetSelectedCount method returns 1. However, the SyncSelected method does allow you to unselect the focused row. In this case, GetSelectedCount will return 0.

You can select multiple rows in the data controller if the MultiSelect property is set to True. In this mode, you can use the ChangeRowSelection, SelectRows and SelectAll methods to change the selection state of rows. Changing the selection state of a row does not affect the focused row. Set the dcoMultiSelectionSyncGroupWithChildren flag in the Options property value to enable selected state synchronization between group rows and their child rows.

Use the GetSelectedCount method to return the number of selected rows.

Different approaches are required when accessing selected records in provider, unbound and default bound modes and when grid mode is applied. Use the supplied ForEachRow method to hide this complexity as it provides iteration of rows regardless of the data mode.

In provider, unbound and default bound modes, the data controller maintains all records loaded from a data source in memory. You can also use the GetSelectedRowIndex method to iterate selected rows. The method’s parameter specifies the index of a selected row, which can vary from 0 to GetSelectedCount -1. The method returns the row index of the selected row. Once you obtain the row index, you can retrieve the row’s details by calling the GetRowInfo function. This information includes the level, expansion state, and its record index. Example1 demonstrates how to access selected rows via GetSelectedRowIndex and ForEachRow.

Grid mode is a special bound mode providing better performance for huge datasets. Set the data controller’s DataModeController.GridMode property to True to enable grid mode. When you group data, grid mode is automatically disabled because this mode does not allow it.

In grid mode, the data controller creates bookmarks for selected data records. You should use the GetSelectedBookmark function to access bookmarks and traverse through the selected records. The ForEachRow method can also be used to iterate records in this mode.

Example2 shows how to change values of a particular field within selected records in bound mode, regardless of the DataModeController.GridMode property setting.

You can also use the View’s OptionsSelection.MultiSelect property to enable multiple record selection in ExpressQuantumGrid. Changing the OptionsSelection.MultiSelect property modifies the data controller’s MultiSelect property.

See Also