Flash
Flash

Reputation: 476

DevExpress cxGrid master detail

I am completely new to DevExpress, and amount of properties and objects just creeps me out.

I have created cxGrid with master detail views. I just cant figure out how to control selecting record within details view. I would like to select specific sub-record programatically.

In case of master view, I can use DataController, but DataController of the details view gives me either -1 or 0 records.

How to access those filtered subrecords of a specific master record?

Upvotes: 1

Views: 5384

Answers (1)

Guillem Vicens
Guillem Vicens

Reputation: 3996

The detail DataController directly accessible from your detail view is sort of a pattern for the real detail DataControllers. What you really need is to get a detail DataController that holds the detail records corresponding to your master record.

In order to do this you have to use the GetDetailDataController method to get a clone of the detail view pattern, which will contain only the detail records of the master record you are interested in.

MyDetailDataController := MasterView.DataController.GetDetailDataController(AMasterRecordIndex, ARelationIndex);

The parameters for this call are following:

  • AMasterRecordIndex specifies the record index of the master.
  • ARelationIndex specifies the detail view index. This is used mostly for cases where a master view has more than one detail view. If you have only one set it to 0.

Upvotes: 4

Related Questions