• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Next Generation Data Grid for Delphi: Master-Detail

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,486
Баллы
155
TMS Software Delphi  Components


Intro


If you’re developing in Delphi and looking for a powerful, flexible, and highly customizable data grid solution, then

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

is the perfect choice. In this blog, we continue on our journey with the TMS FNC Data Grid. The TMS FNC Data Grid offers developers advanced tools for presenting and interacting with data. Master-Detail relationships is a feature to create intuitive and synchronized data representations, where a master grid shows parent records, and a detail grid reflects the corresponding child records based on the selected master entry.

Last Chance Launch Offer


TMS Software Delphi  Components

*To celebrate this release, we're offering a 20% discount on all new licenses for both the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

and

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

. Simply use the code DATAGRID at checkout. This offer applies to single developer, small team, and site licenses. This exclusive discount is valid until October 31, 2024.

Master-Detail

By linking the master and detail grids through the adapter, the detail grid can dynamically refresh and display the appropriate records from the child table. This is achieved by setting up datasets for both tables and using TDataSource components for database linking.

Setting up Master-Detail Tables


The master-detail relationship consists of:

  • Master Table: Contains parent records (e.g., `Orders`).
  • Detail Table: Contains child records linked to the master table (e.g., `OrderDetails` with a foreign key `OrderID`).
Configuring Database Components

  1. Create Datasets
    • Create datasets for the master (`Orders`) and detail (`OrderDetails`) tables.
    • Use `TDataSource` components to link the datasets (`dsMaster` and `dsDetail`).
  2. Configure Database Adapters
    • Place two `TTMSFNCDataGridDatabaseAdapter` components on the form.
    • Set the `DataSource` of `MasterAdapter` to `dsMaster` and `DetailAdapter` to `dsDetail`.

Linking Master and Details Grids

  1. Master Grid Setup
    • Drop a `TTMSFNCDataGrid` component on the form and set it to display fields from the master dataset (`Orders`).
    • Bind this grid to `MasterAdapter`.
  2. Detail Grid Setup
    • Add another `TTMSFNCDataGrid` for the detail dataset (`OrderDetails`).
    • Bind this grid to `DetailAdapter`.
  3. Define Master-Detail Relationship
    • Set the `MasterSource` property of the detail dataset (`dsDetail`) to the master dataset’s `TDataSource`.
    • Define the `MasterFields` to specify the linking key (e.g., `OrderID`).
  4. Display Detail Data:
    • Set the DetailControl property of the `MasterAdapter` to `OrderDetails` Grid
TMS Software Delphi  Components



Custom Detail


With TTMSFNCDataGrid, you have freedom of choice, and this also applies to setting up Master-Detail relationships. In this sample, we created a panel, added a TTMSFNCDataGrid instance which is bound to a detail table, and a chart, also setup via the same detail table.

TMS Software Delphi  Components


Conclusion


Master/Detail relationships are crucial for efficiently presenting data from multiple sources. The "Master" view provides a high-level summary, while the "Detail" section shows specific information for a selected item. This approach enhances user experience by allowing easy navigation of large datasets, improving clarity, and enabling efficient data exploration. It's ideal for applications needing flexible, scalable, and intuitive data management.

In the next blog we'll explore how you can add column & row calculations, so stay tuned for more advanced tips and tutorials on leveraging this next-generation data grid for your Delphi projects! Happy coding!


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу