Skip to main content

TcxDBDataController.OnDetailHasChildren Event

Fires when a grid view needs to determine whether a row’s detail is empty.

Declaration

property OnDetailHasChildren: TcxDBDataDetailHasChildrenEvent read; write;

Remarks

The OnDetailHasChildren event is raised by grid views that have details and work in grid mode or whose details are bound to a parameterized dataset (see the DataModeController.GridMode and DataModeController.DetailInSQLMode property descriptions for details). You only need to handle this event if you need to provide the appropriate functionality for a view’s OptionsView.ExpandButtonsForEmptyDetails option. If this option is disabled, the view needs to determine which master records have empty details associated with them. You must specify this manually by handling the OnDetailHasChildren event.

The OnDetailHasChildren event’s Sender parameter identifies the data controller that raised the event. The ARecordIndex parameter specifies the master record whose detail is to be tested for the presence of data. If there are several details associated, use the ARelationIndex parameter to identify the detail being processed. The AMasterDetailKeyFieldNames parameter passes the names of fields in the detail table that are used to establish the master detail relationship. If there are several fields used for this purpose, their names are separated by semicolon. The AMasterDetailKeyFieldValues parameter returns the variant array holding values in those fields. Use these values to locate those records belonging to the detail dataset that correspond to the specified master record. If there are any detail records found, set the HasChildren parameter to True. This means that the view will display the expand button for the master row being processed. If no detail records have been found, set the parameter to False. The master row’s expand button will not be displayed in this case.

See Also