Project

General

Profile

Actions

Feature #19958

open

Sort search filters and options

Added by taha mohammed el kahlaoui over 9 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Sorting search filters and search options will help to find quickly what u r looking for.
Patching the following method add the requested sort:

  • filters_options_for_select
  • query_available_inline_columns_options
  • query_selected_inline_columns_options

But will be nice if it's in the next release.


Files

view-sort-ascending.png (632 Bytes) view-sort-ascending.png assets/images/view-sort-ascending.png Thomas Löber, 2023-01-10 12:01
Actions #1

Updated by Toshi MARUYAMA over 9 years ago

  • Tracker changed from Defect to Feature
  • Category set to Issues
Actions #2

Updated by Gianni Cavallotto about 2 years ago

+1

Actions #3

Updated by Thomas Löber almost 2 years ago

I'd rather place a small icon assets/images/view-sort-ascending.png next to the drop-down lists to be able to sort the lists on demand.

layouts/base.html.erb:

<script>
$('#query-form, #query_form').find('select').filter('#available_c, #group_by, #query_group_by, #add_filter_select, [id^="query_sort_criteria_attribute_"]').before('<%=
  j link_to_function image_tag('view-sort-ascending.png'), 'sortButtonClicked(this)', class: 'sort-button-link', title: l(:button_sort)
%>')
</script>

application.js:

function sortButtonClicked(button) {
  const select = $(button).hide().siblings('select').first()
  select.find('option').sort((x, y) => $(x).text().localeCompare($(y).text())).appendTo(select)
  select.children('optgroup').remove()
  select.val('')
}

application.css:

.sort-button-link {
    padding-left: 4px;
    padding-right: 4px;
    vertical-align: middle;
}

.sort-button-link img {
    height: 12px;
}

.query-columns .sort-button-link {
    float: right;
}

Actions

Also available in: Atom PDF