Feature #19958

Sort search filters and options

Added by taha mohammed el kahlaoui over 7 years ago. Updated 18 days ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Issues
Target version:-
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.

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

History

#1 Updated by Toshi MARUYAMA over 7 years ago

  • Tracker changed from Defect to Feature
  • Category set to Issues

#2 Updated by Gianni Cavallotto 2 months ago

+1

#3 Updated by Thomas Löber 18 days 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;
}

Also available in: Atom PDF