Przeglądaj źródła

Merge branch 'fix/Process.datagrid' into 'develop'

Merge of fix/[流程管理]修复数据网格正在编辑的时候setData可能异常的问题 to develop

See merge request o2oa/o2oa!591
蔡祥熠 5 lat temu
rodzic
commit
9474b79872

+ 23 - 8
o2web/source/x_component_process_Xform/DatagridMobile.js

@@ -582,11 +582,9 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
             this.close();
         }, null, null, this.form.json.confirmStyle);
     },
-    _completeLineEdit: function( ev, ignoreValidation ){
-	    if( !ignoreValidation ){
-            if (!this.editValidation()){
-                return false;
-            }
+    _completeLineEdit: function( ev ){
+        if (!this.editValidation()){
+            return false;
         }
 
         this.isEdit = false;
@@ -611,6 +609,12 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
         }else{
             //dataNode = new Element("div", {"styles": {"overflow": "hidden", "margin-bottom": "10px"}}).inject(this.table, "before");
             //var tableDiv = new Element("div", {"styles": {"overflow": "hidden"}}).inject(dataNode);
+
+            var dataDiv = this.table.getParent(".datagridDataDiv");
+            if(dataDiv){
+                dataDiv.removeClass("datagridDataDiv").addClass("dataDiv");
+            }
+
             var actions = this.table.getParent().getPrevious("div").getLast("div").getElements("div");
             if (actions[0]) actions[0].setStyle("display", "block");
             if (actions[1]) actions[1].setStyle("display", "block");
@@ -845,8 +849,6 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
                 datagrid._loadTotal();
                 datagrid.getData();
 
-                debugger;
-
                 if (!_self.gridData.data.length){
                     if (_self.addAction){
                         _self.addAction.setStyle("display", "block");
@@ -1120,7 +1122,20 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
             this.gridData = this._getValue();
         }
 
-        if (this.isEdit) this._completeLineEdit( null,true );
+        // if (this.isEdit) this._completeLineEdit();
+        if( this.isEdit ){
+            this.isEdit = false;
+            if (this.currentEditLine) {
+                this._editorTrGoBack();
+                this.currentEditLine.destroy()
+            }else{
+                var datagridDataDiv = this.node.getElement(".datagridDataDiv");
+                this._editorTrGoBack();
+                if(datagridDataDiv)datagridDataDiv.destroy();
+            }
+            this.currentEditLine = null;
+        }
+
         if (this.gridData){
 
             var divs = this.node.getElements(".dataDiv");

+ 13 - 6
o2web/source/x_component_process_Xform/DatagridPC.js

@@ -405,12 +405,10 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
 		}, null, null, this.form.json.confirmStyle);
 
 	},
-	_completeLineEdit: function( ev, ignoreValidation ){
+	_completeLineEdit: function( ev ){
 		//this.currentEditLine.getElemets(td);
-		if( !ignoreValidation ){
-			if (!this.editValidation()){
-				return false;
-			}
+		if (!this.editValidation()){
+			return false;
 		}
 
 		this.isEdit = false;
@@ -948,7 +946,16 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({
             this.gridData = this._getValue();
         }
 
-        if (this.isEdit) this._completeLineEdit(  null,true );
+        // if (this.isEdit) this._completeLineEdit();
+		if( this.isEdit ){ //如果有在编辑的,取消编辑行
+			if (this.currentEditLine) {
+				this.currentEditLine.setStyle("display", "table-row");
+			}
+			this.isEdit = false;
+			this.currentEditLine = null;
+			this._editorTrGoBack();
+		}
+
         if (this.gridData){
             var trs = this.table.getElements("tr");
             for (var i=1; i<trs.length-1; i++){