Skip to content

Feature: Implement natural sort to all order by queries #1083

Open
@Aybee

Description

@Aybee

MySQL scheint ja kein natural sort anzubieten. Hier ein einfaches Beispiel:

sort ASC:
Type 1
Type 11
Type 2

sort ASC natural:
Type 1
Type 2
Type 11

Das wirkt sich negativ auf viele Bereiche aus. Beispiele:

  • Die BE-Listenansicht sortiert nach ASC|DESC
  • Die Reihenfolge in den Filtern im FE
  • Die Reihenfolge in der HTML5 Liste der Tags im FE

An einer Stelle in einem Template habe ich erfolgreich einen Patch aufgesetzt indem ich vor der Ausgabe nochmal mit PHP sortiere.

// Sort options natural
$tmpArray = $this->options;
usort($tmpArray, function($a, $b) {
  return strnatcasecmp($a['value'], $b['value']);
});
$this->options = $tmpArray;

Ist das technisch möglich, dass man im Core direkt nach den Queries das Ergebnis nochmal per PHP sortiert um dann out of the box überall eine natürliche Sortierung erwarten zu können?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis issue is about an enhancement (aka new feature)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions