Skip to content

Commit

Permalink
fix: sort options in group by field
Browse files Browse the repository at this point in the history
(cherry picked from commit 3e9a2d0)

# Conflicts:
#	frappe/public/js/frappe/ui/group_by/group_by.js
  • Loading branch information
barredterra authored and mergify[bot] committed Jun 21, 2023
1 parent 6af04de commit 7d3e3d8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion frappe/public/js/frappe/ui/group_by/group_by.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,15 @@ frappe.ui.GroupBy = class {
const fields = this.report_view.meta.fields.filter((f) =>
['Select', 'Link', 'Data', 'Int', 'Check'].includes(f.fieldtype)
);
<<<<<<< HEAD
const tag_field = {fieldname: '_user_tags', fieldtype: 'Data', label: __('Tags')};
this.group_by_fields[this.doctype] = fields.concat(tag_field);
=======
const tag_field = { fieldname: "_user_tags", fieldtype: "Data", label: __("Tags") };
this.group_by_fields[this.doctype] = fields
.concat(tag_field)
.sort((a, b) => __(a.label).localeCompare(__(b.label)));
>>>>>>> 3e9a2d01e3 (fix: sort options in group by field)
this.all_fields[this.doctype] = this.report_view.meta.fields;

const standard_fields_filter = (df) =>
Expand All @@ -399,7 +406,8 @@ frappe.ui.GroupBy = class {
const cdt = df.options;
const child_table_fields = frappe.meta
.get_docfields(cdt)
.filter(standard_fields_filter);
.filter(standard_fields_filter)
.sort((a, b) => __(a.label).localeCompare(__(b.label)));
this.group_by_fields[cdt] = child_table_fields;
this.all_fields[cdt] = child_table_fields;
});
Expand Down

0 comments on commit 7d3e3d8

Please sign in to comment.