Josef-B - Do 31.03.11 08:06
Titel: devexpress quantumgrid master-detail
Ich verzweifle mal wieder am Quantumgrid ;-)
Ich möchte zwei Firebird-Tabellen darstellen als Master-Detail mit zwei Views
im Grid.
Der Grid-Mode ist false
Ich krieg die Verknüpfung nicht hin.
Es gibt zwei Datasets
DSMaster und DSDetail
Die beiden sind so verknüpft:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9:
| DSMaster.selectsql.text := 'Select * from Inventur'; DSDetail.selectsql.Text := 'Select * from Inventur_pos where pos_id = :ID order by pos_id';
DSDetail.datasource := DatasourceMaster;
ViewMaster.keyfieldnames := 'ID'; ViewDetail.keyfieldnames := 'ID'; ViewDetail.Masterkeyfieldnames := 'ID'; ViewDetail.Detailkeyfieldnames := 'POS_ID'; |
Mein Problem ist, die Details werden nicht richtig angezeigt, mal werden alle Details der gesamten
Tabelle bei allen Mastersätzen angezeigt, mal irgendwas, kann ich keine Regel beschreiben
Ich hab mir die Hilfe angesehen, danach brauchte man wohl die Verknüpfung der Datasets gar nicht,
würde bei gridmode = false der Datacontroller des Views machen, oder?
Irgendwie müsste man glaub ich noch die Daten sortieren?
das hier verstehe ich nicht ganz aus der Devexpress-Hilfe
Sorting the detail dataset
The last step of setting up a master-detail relationship is to sort the detail dataset (for parameterized queries this is not necessary). Providing that the detail dataset is sorted, the data controller will correctly retrieve all the necessary records from it. The detail dataset must be sorted against the fields specified by the DetailKeyFieldNames property.
To enable sorting for query datasets, you should use the "ORDER BY" SQL command. For TTable and TCustomADODataSet components, the sorting of dataset records is implemented via the IndexFieldNames property. In this example, we need to set the IndexFieldNames property of the dsFilmsPersonsStaff dataset to FILMID (the same value as for the tvFilmsPersonsStaff.DataController.DetailKeyFieldNames property).