What problem does this feature solve?
Currently, the MasterDetailPlugin automatically looks for the children field in the main table row data to populate the detail table. This behavior is hardcoded, forcing users to rename their data fields to children even if their backend or business logic uses a different name (e.g., details, subItems, etc.).
目前 MasterDetailPlugin 固定从主表对应行数据的 children 字段中获取子表所需的记录(records)。如果原始数据中的字段名不是 children(例如是 details 或 items),用户必须手动进行数据转换,将字段名重置为 children 才能正常显示子表。
Benefit / 收益:
Avoid unnecessary data transformation and improve developer experience.
避免不必要的数据结构转换,提高接入效率。
What does the proposed API look like?
Add a configuration option, e.g., childrenKey or recordsField, to MasterDetailPlugin or DetailTableOptions to specify the field name where sub-table data is stored.
在插件配置或 DetailTableOptions 中增加一个配置项(如 childrenKey),允许自定义子表数据的字段名。
Example / 示例:
new MasterDetailPlugin({
childrenKey: 'myCustomDetails', // New suggested option
detailTableOptions: {
// ...
}
})