Display sort order in quick search results
authorThierry Florac <thierry.florac@onf.fr>
Tue, 28 Aug 2018 16:19:33 +0200 (2018-08-28)
changeset 898 2d346aeb66d6
parent 897 2b4b479166b7
child 899 69b028b6eecb
Display sort order in quick search results
src/pyams_content/root/zmi/search.py
src/pyams_content/shared/common/zmi/search.py
--- a/src/pyams_content/root/zmi/search.py	Tue Aug 28 15:43:03 2018 +0200
+++ b/src/pyams_content/root/zmi/search.py	Tue Aug 28 16:19:33 2018 +0200
@@ -91,12 +91,13 @@
     title = _("Quick search results")
 
     sortOn = None
+    dt_sort_order = 'desc'
 
     @property
     def data_attributes(self):
         attributes = super(SiteRootQuickSearchResults, self).data_attributes
         attributes['table'] = {
-            'data-ams-datatable-sorting': '[]',
+            'data-ams-datatable-sorting': '{0},{1}'.format(len(self.columns) - 1, self.dt_sort_order),
             'data-ams-datatable-display-length': IAdminProfile(self.request.principal).table_page_length
         }
         return attributes
--- a/src/pyams_content/shared/common/zmi/search.py	Tue Aug 28 15:43:03 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/search.py	Tue Aug 28 16:19:33 2018 +0200
@@ -92,12 +92,13 @@
     title = _("Quick search results")
 
     sortOn = None
+    dt_sort_order = 'desc'
 
     @property
     def data_attributes(self):
         attributes = super(SharedToolQuickSearchResults, self).data_attributes
         attributes['table'] = {
-            'data-ams-datatable-sorting': '[]',
+            'data-ams-datatable-sorting': '{0},{1}'.format(len(self.columns) - 1, self.dt_sort_order),
             'data-ams-datatable-display-length': IAdminProfile(self.request.principal).table_page_length
         }
         return attributes