Giorgi625 VIP
Total posts: 655
09 Авг 2018 15:16

Hello, is it possible to add sorting by ID in list view on frontend? I have overriden creation date from date&time field so I am not able to sort items by creation date and wanted to sort them via ID as it is in backend.

is there any code which I can just paste somewhere in markup template and add this feature? (Also want to show only to superuser)

Последние изменения: 19 Авг 2018


Sergey
Total posts: 13,748
19 Авг 2018 08:00
  1. Edit file components/com_cobalt/models/records.php and in line 81 inset new line and add 'r.id',
  2. Then anywhere on th page you can add
<a href="javascript:void(0);" onclick="Joomla.tableOrdering('r.id','asc','');">Order by ID ASC <i class="icon-arrow-up"></i></a>
<a href="javascript:void(0);" onclick="Joomla.tableOrdering('r.id','desc','');">Order by ID DESC <i class="icon-arrow-down"></i></a>

Or you can use prefiltered links.

Работает на Cobalt