Skip to content

Allow to sort the whole spreadsheet even if one single column was selected

Description

With respect to the sorting in the spreadsheet we have now the following options:

  1. sort the whole spreadsheet via selecting "Sort" in the context menu of the spreadsheet (RMB click somewhere in the spreadsheet) - here we bring up the SortDialog allowing the user to determine how to sort (asc vs desc) and which leading/ column to use
  2. sort multiple selected columns via the column context menu (RMB click on the horizontal header) - also here we bring up the SortDialog with the same option, limit the scope of columns to the selected columns only
  3. sort one single column via the column context menu - here we directly sort with asc or desc depending on which action was used from the context menu

The third point is confusing since this is not what is needed in most of the cases (sorting one single column without touching the neighbor columns is rarely needed) and the user rather expects to be able to sort the whole spreadsheet with the currently selected column as the key column for the sort algorithm.

This MR addresses the last point and allows to sort the whole spreadsheet even if one single column was selected. The column context menu still have those "asc" and "desc" actions to sort one single column only but additionally we have now the new action "Sort..." which brings up the SortDialog and makes the current column as the key one:

image

The new action "Sort.." was also added to spreadsheet's toolbar:

image

To summarize:

  • the action "Sort..." is doing the custom sort of all or selected columns in a grouped manner ("sort together") and allows to specify the leading column in the SortDialog
  • the actions "Sort Asc" and "Sort Desc" sort the selected column separately of each other.

This behavior is now similar to what LibreCalc is also doing and is more useful I think.

The SortDialog was simplified - the option "separately vs together" was removed and the option "leading column" was renamed to "Sort by column" which is what is actually happening here and how it's also called in Excel and co:

image

Later we'll allow to add more "then by" columns.

This was triggered by the discussion in https://discuss.kde.org/t/labplot-general-usage-questions/4135/. @dlaska @chrismettal

Conformity

Edited by Alexander Semke

Merge request reports