src/pyams_content/shared/common/zmi/search.py
changeset 1408 916c81459d6b
parent 1407 85e615286c7a
--- a/src/pyams_content/shared/common/zmi/search.py	Sun Jul 19 02:10:25 2020 +0200
+++ b/src/pyams_content/shared/common/zmi/search.py	Mon Jul 20 12:30:49 2020 +0200
@@ -215,6 +215,10 @@
 
     legend = _("Advanced search")
 
+    fields_interface = ISharedToolAdvancedSearchFields
+    sort_results = True
+
+    prefix = 'search_form.'
     ajax_handler = 'advanced-search-results.html'
 
     def __init__(self, context, request):
@@ -222,8 +226,6 @@
         request.registry.notify(PageletCreatedEvent(self))
         apply_skin(self.request, 'PyAMS admin skin')
 
-    fields_interface = ISharedToolAdvancedSearchFields
-
     @property
     def fields(self):
         workflow = IWorkflow(self.context)
@@ -371,11 +373,14 @@
     def data_attributes(self):
         attributes = super(SharedToolAdvancedSearchResultsView, self).data_attributes
         attributes['table'] = {
-            '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
         }
+        if self.search_form.sort_results:
+            attributes['table']['data-ams-datatable-sorting'] = \
+                "{0},{1}".format(len(self.columns) - 1, self.dt_sort_order)
+        else:
+            attributes['table']['data-ams-datatable-sorting'] = '[]'
         return attributes