[glom/glom-1-20] Choices: Make sure related choices are sorted.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-20] Choices: Make sure related choices are sorted.
- Date: Sat, 24 Dec 2011 22:08:34 +0000 (UTC)
commit 5ec840748d7f28e6df82604b296c9345e4d494e1
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Dec 24 16:40:21 2011 +0100
Choices: Make sure related choices are sorted.
* glom/mode_data/datawidget/combochoiceswithtreemodel.cc:
set_choices_related(): Add a sort clause, though it would be best if
the developer could specify this.
Note that Utils::get_choice_values(), used for other choices, already
does this, and we should reduce the code duplication.
ChangeLog | 10 ++++++++++
.../datawidget/combochoiceswithtreemodel.cc | 4 ++++
2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 42790e1..10a75e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-12-24 Murray Cumming <murrayc murrayc com>
+
+ Choices: Make sure related choices are sorted.
+
+ * glom/mode_data/datawidget/combochoiceswithtreemodel.cc:
+ set_choices_related(): Add a sort clause, though it would be best if
+ the developer could specify this.
+ Note that Utils::get_choice_values(), used for other choices, already
+ does this, and we should reduce the code duplication.
+
2011-12-23 Murray Cumming <murrayc murrayc com>
Document_XML: Remove an unimplemented method.
diff --git a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
index 61248c3..eb7eccc 100644
--- a/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
+++ b/glom/mode_data/datawidget/combochoiceswithtreemodel.cc
@@ -277,6 +277,10 @@ void ComboChoicesWithTreeModel::set_choices_related(const Document* document, co
to_table, to_field, foreign_key_value);
}
+ //Sort by the first field, because that is better than so sort at all.
+ //TODO: Allow the developer to specify the sort order:
+ found_set.m_sort_clause.push_back( FoundSet::type_pair_sort_field(layout_choice_first, true /* ascending */) );
+
m_db_layout_items.clear();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]