mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-03 14:06:45 +01:00
Use natural sorting for string datatables columns when using postgres
The natural sorting solution is quite portable, so this should be possible for other database types too later
This commit is contained in:
@@ -82,7 +82,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
||||
|
||||
->add('name', TextColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.name'),
|
||||
'orderField' => 'part.name',
|
||||
'orderField' => 'NATSORT(part.name)',
|
||||
'render' => function ($value, ProjectBOMEntry $context) {
|
||||
if(!$context->getPart() instanceof Part) {
|
||||
return htmlspecialchars($context->getName());
|
||||
@@ -101,7 +101,7 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
||||
])
|
||||
->add('ipn', TextColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.ipn'),
|
||||
'orderField' => 'part.ipn',
|
||||
'orderField' => 'NATSORT(part.ipn)',
|
||||
'visible' => false,
|
||||
'render' => function ($value, ProjectBOMEntry $context) {
|
||||
if($context->getPart() instanceof Part) {
|
||||
@@ -124,18 +124,18 @@ class ProjectBomEntriesDataTable implements DataTableTypeInterface
|
||||
->add('category', EntityColumn::class, [
|
||||
'label' => $this->translator->trans('part.table.category'),
|
||||
'property' => 'part.category',
|
||||
'orderField' => 'category.name',
|
||||
'orderField' => 'NATSORT(category.name)',
|
||||
])
|
||||
->add('footprint', EntityColumn::class, [
|
||||
'property' => 'part.footprint',
|
||||
'label' => $this->translator->trans('part.table.footprint'),
|
||||
'orderField' => 'footprint.name',
|
||||
'orderField' => 'NATSORT(footprint.name)',
|
||||
])
|
||||
|
||||
->add('manufacturer', EntityColumn::class, [
|
||||
'property' => 'part.manufacturer',
|
||||
'label' => $this->translator->trans('part.table.manufacturer'),
|
||||
'orderField' => 'manufacturer.name',
|
||||
'orderField' => 'NATSORT(manufacturer.name)',
|
||||
])
|
||||
|
||||
->add('mountnames', TextColumn::class, [
|
||||
|
||||
Reference in New Issue
Block a user