Skip to content

Commit

Permalink
fix(ListView): Evaluate sort_field sort_order within listviews based …
Browse files Browse the repository at this point in the history
…on DocTypes Definition (#20482)

(cherry picked from commit 7962505)
  • Loading branch information
pstuhlmueller authored and mergify[bot] committed Apr 10, 2023
1 parent ec1c63c commit ba3cf84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions frappe/public/js/frappe/list/base_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ frappe.views.BaseList = class BaseList {

this.fields = [];
this.filters = [];
this.sort_by = "modified";
this.sort_order = "desc";
this.sort_by = this.meta.sort_field || "modified";
this.sort_order = this.meta.sort_order || "desc";

// Setup buttons
this.primary_action = null;
Expand Down
4 changes: 2 additions & 2 deletions frappe/public/js/frappe/list/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {

this.view = "List";
// initialize with saved order by
this.sort_by = this.view_user_settings.sort_by || "modified";
this.sort_order = this.view_user_settings.sort_order || "desc";
this.sort_by = this.view_user_settings.sort_by || this.sort_by || "modified";
this.sort_order = this.view_user_settings.sort_order || this.sort_order || "desc";

// set filters from user_settings or list_settings
if (
Expand Down

0 comments on commit ba3cf84

Please sign in to comment.