Bläddra i källkod

Merge branch 'wrdp' into 'develop'

Wrdp

See merge request o2oa/o2oa!2356

(cherry picked from commit a1f5657d3d21455befc86fc9328901150505f459)

bdd5b50f 修复CMS列表排序可能存在的问题
e6f1d33f Merge branch 'fix/CMS.list_order' into 'wrdp'
蔡祥熠 5 år sedan
förälder
incheckning
3fa28fa53c
1 ändrade filer med 12 tillägg och 7 borttagningar
  1. 12 7
      o2web/source/x_component_cms_Module/ListExplorer.js

+ 12 - 7
o2web/source/x_component_cms_Module/ListExplorer.js

@@ -345,6 +345,7 @@ MWF.xApplication.cms.Module.ListExplorer.DefaultList = new Class({
         this.loadElementList();
     },
     resort : function(th){
+        debugger;
         this.orderField = th.retrieve("field");
         var orderType = th.retrieve("orderType");
         //th.eliminate(orderType);
@@ -757,16 +758,20 @@ MWF.xApplication.cms.Module.ListExplorer.List = new Class({
         }.bind(this));
     },
     resort : function(th){
+        debugger;
         this.orderField = th.retrieve("field");
         this.orderType = ( th.retrieve("orderType") || "" ).toLowerCase();
-        //th.eliminate(orderType);
-        if( this.orderType == "" ){
-            this.orderType = "asc";
-        }else if( this.orderType == "asc" ){
-            this.orderType = "desc";
+        if( this.orderField === this.data.orderField ){
+            this.orderType = this.orderType === "asc" ? "desc" : "asc";
         }else{
-            this.orderField = this.data.orderField ? this.data.orderField : "";
-            this.orderType = this.data.orderType ? this.data.orderType : "";
+            if( this.orderType == "" ){
+                this.orderType = "asc";
+            }else if( this.orderType == "asc" ){
+                this.orderType = "desc";
+            }else{
+                this.orderField = this.data.orderField ? this.data.orderField : "";
+                this.orderType = this.data.orderType ? this.data.orderType : "";
+            }
         }
         this.reload();
     },