feat(parts table): add eda reference prefix and value columns#1266
feat(parts table): add eda reference prefix and value columns#1266hrueger wants to merge 1 commit intoPart-DB:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds two dedicated columns to the Parts DataTable to display EDA reference prefix and EDA value separately, improving table readability when descriptions are inconsistently formatted.
Changes:
- Add
eda_info_reference_prefixcolumn with label, rendering, and natural-sort ordering. - Add
eda_info_valuecolumn with label, rendering, and natural-sort ordering.
| 'render' => fn($value, Part $context) => htmlspecialchars($context->getEdaInfo()->getReferencePrefix() ?? ''), | ||
| 'orderField' => 'NATSORT(part.eda_info.reference_prefix)' | ||
| ]) | ||
| ->add('eda_info_value', TextColumn::class, [ | ||
| 'label' => $this->translator->trans('eda_info.value'), | ||
| 'render' => fn($value, Part $context) => htmlspecialchars($context->getEdaInfo()->getValue() ?? ''), |
There was a problem hiding this comment.
The new EDA columns don’t set a Doctrine field. With TwoStepORMAdapter, default field mapping is only applied when the column name matches a mapped entity field, so eda_info_reference_prefix/eda_info_value will have field = null and therefore won’t participate in global search (and any other criteria that relies on field). If these columns should be searchable, set field (and optionally searchField) to part.eda_info.reference_prefix / part.eda_info.value and you can then render from the $value argument instead of re-reading from $context.
| 'render' => fn($value, Part $context) => htmlspecialchars($context->getEdaInfo()->getReferencePrefix() ?? ''), | |
| 'orderField' => 'NATSORT(part.eda_info.reference_prefix)' | |
| ]) | |
| ->add('eda_info_value', TextColumn::class, [ | |
| 'label' => $this->translator->trans('eda_info.value'), | |
| 'render' => fn($value, Part $context) => htmlspecialchars($context->getEdaInfo()->getValue() ?? ''), | |
| 'field' => 'part.eda_info.reference_prefix', | |
| 'searchField' => 'part.eda_info.reference_prefix', | |
| 'render' => fn($value, Part $context) => htmlspecialchars($value ?? ''), | |
| 'orderField' => 'NATSORT(part.eda_info.reference_prefix)' | |
| ]) | |
| ->add('eda_info_value', TextColumn::class, [ | |
| 'label' => $this->translator->trans('eda_info.value'), | |
| 'field' => 'part.eda_info.value', | |
| 'searchField' => 'part.eda_info.value', | |
| 'render' => fn($value, Part $context) => htmlspecialchars($value ?? ''), |
|
I'm unsure about what copilot suggests here, as none of the other |
Hi,
I hope this makes sense 👍 I don't have my part descriptions formatted the same way everywhere, so I'd like to show this in a separate column.
Feel free to suggest any changes / improvements!