mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding sort options for columns.
Summary: Adding sort options for columns. - Sort menu has a new option "More sort options" that opens up Sort left menu - Each sort entry has an additional menu with 3 options -- Order by choice index (for the Choice column, orders by choice position) -- Empty last (puts empty values last in ascending order, first in descending order) -- Natural sort (for Text column, compares strings with numbers as numbers) Updated also CSV/Excel export and api sorting. Most of the changes in this diff is a sort expression refactoring. Pulling out all the methods that works on sortExpression array into a single namespace. Test Plan: Browser tests Reviewers: alexmojaki Reviewed By: alexmojaki Subscribers: dsagal, alexmojaki Differential Revision: https://phab.getgrist.com/D3077
This commit is contained in:
@@ -11,6 +11,7 @@ import acl
|
||||
from acl_formula import parse_acl_formula_json
|
||||
import actions
|
||||
import column
|
||||
import sort_specs
|
||||
import identifiers
|
||||
from objtypes import strict_equal, encode_object
|
||||
import schema
|
||||
@@ -877,7 +878,8 @@ class UserActions(object):
|
||||
for section in parent_sections:
|
||||
# Only iterates once for each section. Updated sort removes all columns being deleted.
|
||||
sort = json.loads(section.sortColRefs) if section.sortColRefs else []
|
||||
updated_sort = [sort_ref for sort_ref in sort if abs(sort_ref) not in removed_col_refs]
|
||||
updated_sort = [col_spec for col_spec in sort
|
||||
if sort_specs.col_ref(col_spec) not in removed_col_refs]
|
||||
if sort != updated_sort:
|
||||
re_sort_sections.append(section)
|
||||
re_sort_specs.append(json.dumps(updated_sort))
|
||||
|
||||
Reference in New Issue
Block a user