pivotal-energy-solutions/django-datatable-view

[Question] Override `sort()` (or similar) for custom columns

Pk13055 opened this issue · 1 comments

Currently, sort isn't working on OneToOneField() . If I could just override the sort functionality in some way by creating a custom column, I could get the unrestricted lookup that I need, which inevitably leads to my question:
Would it be possible to override sort() functionality for columns? (something similar to the search() override as mentioned in #7 )

tiliv commented

Since there are no Column types for relationship fields of any kind (you have to use a concrete type, like IntegerColumn for a numerical pk, etc), I can't say for sure if there is a bug or configuration problem. Any column correctly declaring a source or sources should be able to resolve the ORM field(s) and columninstance.get_sort_fields(model) should return database-sortable fields that are safe for sending to a queryset order_by.

If you've still got an example you can show me, I'd be happy to look!