Преглед изворни кода

HUE-1170 [beeswax] Smarter sorting for queries

Default sorting by Last Modified desc on Saved Queries
The table sorting is persisted on the client side
Enrico Berti пре 12 година
родитељ
комит
830ad94b23

+ 3 - 2
apps/beeswax/src/beeswax/templates/list_designs.mako

@@ -126,7 +126,7 @@ ${layout.menubar(section='saved queries')}
       "bLengthChange":false,
       "bInfo":false,
       "aaSorting":[
-        [1, 'asc']
+        [4, 'desc']
       ],
       "aoColumns":[
         {"bSortable":false, "sWidth":"1%" },
@@ -138,7 +138,8 @@ ${layout.menubar(section='saved queries')}
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}",
-      }
+      },
+      "bStateSave": true
     });
 
     $("#filterInput").keyup(function () {

+ 34 - 31
apps/beeswax/src/beeswax/templates/list_history.mako

@@ -134,38 +134,41 @@ ${ layout.menubar(section='history') }
 </div>
 
 <script type="text/javascript" charset="utf-8">
-    $(document).ready(function(){
-        $(".datatables").dataTable({
-            "bPaginate": false,
-            "bLengthChange": false,
-            "bInfo": false,
-            "bFilter": false,
-            "aoColumns": [
-                { "sSortDataType": "dom-sort-value", "sType": "numeric" },
-                null,
-                null,
-                null,
-                null,
-                { "bSortable": false }
-            ],
-            "aaSorting": [[0, 'desc']],
-            "oLanguage": {
-                "sEmptyTable":     "${_('No data available')}",
-                "sInfo":           "${_('Showing _START_ to _END_ of _TOTAL_ entries')}",
-                "sInfoEmpty":      "${_('Showing 0 to 0 of 0 entries')}",
-                "sInfoFiltered":   "${_('(filtered from _MAX_ total entries)')}",
-                "sZeroRecords":    "${_('No matching records')}",
-                "oPaginate": {
-                    "sFirst":    "${_('First')}",
-                    "sLast":     "${_('Last')}",
-                    "sNext":     "${_('Next')}",
-                    "sPrevious": "${_('Previous')}"
-                }
-            }
-        });
-
-        $("a[data-row-selector='true']").jHueRowSelector();
+  $(document).ready(function () {
+    $(".datatables").dataTable({
+      "bPaginate": false,
+      "bLengthChange": false,
+      "bInfo": false,
+      "bFilter": false,
+      "aoColumns": [
+        { "sSortDataType": "dom-sort-value", "sType": "numeric" },
+        null,
+        null,
+        null,
+        null,
+        { "bSortable": false }
+      ],
+      "aaSorting": [
+        [0, 'desc']
+      ],
+      "oLanguage": {
+        "sEmptyTable": "${_('No data available')}",
+        "sInfo": "${_('Showing _START_ to _END_ of _TOTAL_ entries')}",
+        "sInfoEmpty": "${_('Showing 0 to 0 of 0 entries')}",
+        "sInfoFiltered": "${_('(filtered from _MAX_ total entries)')}",
+        "sZeroRecords": "${_('No matching records')}",
+        "oPaginate": {
+          "sFirst": "${_('First')}",
+          "sLast": "${_('Last')}",
+          "sNext": "${_('Next')}",
+          "sPrevious": "${_('Previous')}"
+        }
+      },
+      "bStateSave": true
     });
+
+    $("a[data-row-selector='true']").jHueRowSelector();
+  });
 </script>
 
 ${ commonfooter(messages) | n,unicode }

+ 4 - 2
apps/beeswax/src/beeswax/templates/my_queries.mako

@@ -189,7 +189,8 @@ ${layout.menubar(section='my queries')}
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}"
-      }
+      },
+      "bStateSave": true
     });
 
     var recentRunQueries = $("#recentRunQueriesTable").dataTable({
@@ -210,7 +211,8 @@ ${layout.menubar(section='my queries')}
       "oLanguage":{
         "sEmptyTable":"${_('No data available')}",
         "sZeroRecords":"${_('No matching records')}"
-      }
+      },
+      "bStateSave": true
     });
 
     $("#filterInput").keyup(function () {