adminjs
adminjs copied to clipboard
allow to sort by relationships
It is required - has to be done either systematically in the admin-bro core, or allow a simple way of enhancing filters
Blocker: #251
Filtering and sorting by relationships would probably require our adapters:
-
@adminjs/typeorm
-
@adminjs/sequelize
-
@adminjs/mikroorm
-
@adminjs/prisma
-
@adminjs/objection
-
@adminjs/sql
to run JOINs in queries which would break the current functionality where you can assign relationships between multiple different databases. Filtering and sorting post-query would in turn break the pagination.
Suggestions how to resolve the above concerns are welcome.
@dziraf Maybe create some additional column that would contain the sorting key - for example id
, or maybe some other column of the entity - and then sort by this column? To explain it better, you would have something like this:
Post:
id
: 1
title
: Test
category
: relation to Category
_category_sort
: TestCategory
Category:
id
: 1
name
: TestCategory
The only downside of that is that you need to keep the sort column updated.