diff --git a/o2web/source/x_component_process_Xform/DatagridMobile.js b/o2web/source/x_component_process_Xform/DatagridMobile.js index 7247e65481b8cf314ff168c0ead699f1fa9504c9..32602dfb3e8a54fa604f0f3edbf3fac32008b809 100644 --- a/o2web/source/x_component_process_Xform/DatagridMobile.js +++ b/o2web/source/x_component_process_Xform/DatagridMobile.js @@ -331,6 +331,10 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ "styles": this.form.css.mobileDatagridAddActionNode, "text": MWF.xApplication.process.Xform.LP.add }).inject(actionNode); + var cancelAction = new Element("div", { + "styles": this.form.css.mobileDatagridDelActionNode, + "text": MWF.xApplication.process.Xform.LP.cancelEdit + }).inject(actionNode); var completeAction = new Element("div", { "styles": this.form.css.mobileDatagridCompleteActionNode, "text": MWF.xApplication.process.Xform.LP.completedEdit @@ -347,6 +351,9 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ completeAction.addEvent("click", function(e){ _self._completeLineEdit(); }); + cancelAction.addEvent("click", function(e){ + _self._cancelLineEdit(e); + }); addAction.addEvent("click", function(e){ _self._addLine(); }); @@ -410,6 +417,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ if (actions[1]) actions[1].setStyle("display", "none"); if (actions[2]) actions[2].setStyle("display", "none"); if (actions[3]) actions[3].setStyle("display", "block"); + if (actions[4]) actions[4].setStyle("display", "block"); //this.addAction.inject(this.table, "after"); //this.addAction.set("text", MWF.xApplication.process.Xform.LP.completedEdit); @@ -462,7 +470,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ var tables = this.node.getElements("table"); var idx; - var dataDiv = new Element("div", {"styles": {"overflow": "hidden", "margin-bottom": "10px"}}); + var dataDiv = new Element("div.datagridDataDiv", {"styles": {"overflow": "hidden", "margin-bottom": "10px"}}); if (this.totalDiv){ idx = tables.length-2; dataDiv.inject(this.totalDiv, "before"); @@ -488,6 +496,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ if (actions[1]) actions[1].setStyle("display", "none"); if (actions[2]) actions[2].setStyle("display", "none"); if (actions[3]) actions[3].setStyle("display", "block"); + if (actions[4]) actions[4].setStyle("display", "block"); if (!dataDiv.isIntoView()) dataDiv.scrollIntoView(true); @@ -500,6 +509,52 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ this.validationMode(); this.fireEvent("addLine"); }, + _cancelLineEdit : function(e){ + var datagrid = this; + var _self = this; + this.form.confirm("warn", e, MWF.xApplication.process.Xform.LP.cancelDatagridLineEditTitle, MWF.xApplication.process.Xform.LP.cancelDatagridLineEdit, 300, 120, function(){ + + datagrid.isEdit = false; + + if (datagrid.currentEditLine) { + // datagrid.currentEditLine.setStyle("display", "table-row"); + + var currentEditTable = datagrid.currentEditLine.getElement("table"); + currentEditTable.setStyle("display", "table"); + + var actions = datagrid.currentEditLine.getFirst("div").getLast("div").getElements("div"); + if (actions[0]) actions[0].setStyle("display", "block"); + if (actions[1]) actions[1].setStyle("display", "block"); + if (actions[2]) actions[2].setStyle("display", "block"); + if (actions[3]) actions[3].setStyle("display", "none"); + if (actions[4]) actions[4].setStyle("display", "none"); + + datagrid._editorTrGoBack(); + }else{ + var datagridDataDiv = e.target.getParent(".datagridDataDiv"); + datagrid._editorTrGoBack(); + if(datagridDataDiv)datagridDataDiv.destroy(); + } + + datagrid.currentEditLine = null; + + if (!_self.gridData.data.length){ + if (_self.addAction){ + _self.addAction.setStyle("display", "block"); + }else{ + _self._loadAddAction(); + } + } + + this.close(); + + datagrid.fireEvent("cancelLineEdit"); + }, function(){ + // var color = currentTr.retrieve("bgcolor"); + // currentTr.tween("background", color); + this.close(); + }, null, null, this.form.json.confirmStyle); + }, _completeLineEdit: function(){ if (!this.editValidation()){ return false; @@ -522,6 +577,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ if (actions[1]) actions[1].setStyle("display", "block"); if (actions[2]) actions[2].setStyle("display", "block"); if (actions[3]) actions[3].setStyle("display", "none"); + if (actions[4]) actions[4].setStyle("display", "none"); }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); @@ -530,6 +586,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ if (actions[1]) actions[1].setStyle("display", "block"); if (actions[2]) actions[2].setStyle("display", "block"); if (actions[3]) actions[3].setStyle("display", "none"); + if (actions[4]) actions[4].setStyle("display", "none"); table = new Element("table", { styles : this.json.tableStyles @@ -758,7 +815,15 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ datagrid._loadTotal(); datagrid.getData(); - if (!_self.gridData.data.length) if (_self.addAction) _self.addAction.setStyle("display", "block"); + debugger; + + if (!_self.gridData.data.length){ + if (_self.addAction){ + _self.addAction.setStyle("display", "block"); + }else{ + _self._loadAddAction(); + } + } this.close(); _self.fireEvent("afterDeleteLine"); @@ -931,7 +996,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({ datath.setStyles(this.json.titleStyles); tr.insertCell(1).setStyles(this.json.amountStyles).set("text", totalResaults[i] || ""); }else{ - tr.getElement("td").set("text", isNaN( totalResaults[i] ) ? "" : totalResaults[i]); + tr.getElement("td").set("text", totalResaults[i] || ""); } this.totalResaults[m.module.json.id] = totalResaults[i]; }.bind(this)); diff --git a/o2web/source/x_component_process_Xform/DatagridPC.js b/o2web/source/x_component_process_Xform/DatagridPC.js index 0e518943687615d7dda4e25f4952e390fd9cdaf8..338478260bf8e2a585642093b62a3ec23dd5a3b3 100644 --- a/o2web/source/x_component_process_Xform/DatagridPC.js +++ b/o2web/source/x_component_process_Xform/DatagridPC.js @@ -89,6 +89,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({ var actionEditTd = new Element("td").inject(this.editorTr, "top"); this._createCompleteAction(actionEditTd); + this._createCancelAction(actionEditTd); new Element("td").inject(this.editorTr, "bottom"); @@ -263,6 +264,17 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({ }); completeAction.inject(td); }, + _createCancelAction: function(td){ + var cancelAction = new Element("div", { + "styles": this.form.css.delLineAction, + "events": { + "click": function(e){ + this._cancelLineEdit(e); + }.bind(this) + } + }); + cancelAction.inject(td); + }, _editLine:function(td){ if (this.isEdit){ @@ -324,42 +336,74 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({ return flag; }, - _cancelLineEdit: function(){ - this.isEdit = false; - - var flag = true; - - var griddata = {}; - var newTr = null; + // _cancelLineEdit: function(e){ + // this.isEdit = false; + // + // var flag = true; + // + // var griddata = {}; + // var newTr = null; + // + // if (this.currentEditLine){ + // newTr = this.currentEditLine; + // griddata = this.currentEditLine.retrieve("data"); + // }else{ + // newTr = new Element("tr").inject(this.editorTr, "before"); + // griddata = {}; + // } + // + // if (flag){ + // newTr.destroy(); + // } + // this.currentEditLine = null; + // + // this._editorTrGoBack(); + // + // // if (this.json.contentStyles){ + // // var tds = newTr.getElements("td"); + // // tds.setStyles(this.json.contentStyles); + // // } + // // if (this.json.actionStyles){ + // // newTr.getFirst().setStyles(this.json.actionStyles); + // // } + // + // // this._loadBorderStyle(); + // // this._loadZebraStyle(); + // // this._loadSequence(); + // + // this.fireEvent("cancelLineEdit"); + // }, + _cancelLineEdit: function(e){ + + var datagrid = this; + this.form.confirm("warn", e, MWF.xApplication.process.Xform.LP.cancelDatagridLineEditTitle, MWF.xApplication.process.Xform.LP.cancelDatagridLineEdit, 300, 120, function(){ + if (datagrid.currentEditLine) { + datagrid.currentEditLine.setStyle("display", "table-row"); + } - if (this.currentEditLine){ - newTr = this.currentEditLine; - griddata = this.currentEditLine.retrieve("data"); - }else{ - newTr = new Element("tr").inject(this.editorTr, "before"); - griddata = {}; - } + datagrid.isEdit = false; + datagrid.currentEditLine = null; - if (flag){ - newTr.destroy(); - } - this.currentEditLine = null; + datagrid._editorTrGoBack(); - this._editorTrGoBack(); + // this._loadBorderStyle(); + // this._loadZebraStyle(); + // this._loadSequence(); + // this.getData(); - // if (this.json.contentStyles){ - // var tds = newTr.getElements("td"); - // tds.setStyles(this.json.contentStyles); - // } - // if (this.json.actionStyles){ - // newTr.getFirst().setStyles(this.json.actionStyles); - // } + // datagrid._loadZebraStyle(); + // datagrid._loadSequence(); + // datagrid._loadTotal(); + // datagrid.getData(); + this.close(); - // this._loadBorderStyle(); - // this._loadZebraStyle(); - // this._loadSequence(); + datagrid.fireEvent("cancelLineEdit"); + }, function(){ + // var color = currentTr.retrieve("bgcolor"); + // currentTr.tween("background", color); + this.close(); + }, null, null, this.form.json.confirmStyle); - this.fireEvent("cancelLineEdit"); }, _completeLineEdit: function(){ //this.currentEditLine.getElemets(td); @@ -524,7 +568,7 @@ MWF.xApplication.process.Xform.DatagridPC = new Class({ currentTr.tween("background", color); this.close(); }, null, null, this.form.json.confirmStyle); - }; + } this.validationMode(); }, _createMoveLineAction: function(td){ diff --git a/o2web/source/x_component_process_Xform/lp/zh-cn.js b/o2web/source/x_component_process_Xform/lp/zh-cn.js index 4340f7d62985aff3fa351d443cb6c2ea3b3d0659..0844a820c1ab405619f31dcddf49332791869aa6 100644 --- a/o2web/source/x_component_process_Xform/lp/zh-cn.js +++ b/o2web/source/x_component_process_Xform/lp/zh-cn.js @@ -2,6 +2,10 @@ MWF.xApplication.process.Xform.LP = { "ok": "确定", "deleteDatagridLineTitle":"删除条目确认", "deleteDatagridLine": "是否确定要删除当前条目?", + + "cancelDatagridLineEditTitle" : "取消编辑数据网格确认", + "cancelDatagridLineEdit" : "是否确定取消编辑数据网格?", + "browserNotActiveX": "您的浏览器不支持ActiveX控件,不能加载Office控件,请使用IE浏览器", "activity": "活动", @@ -98,6 +102,7 @@ MWF.xApplication.process.Xform.LP = { "addLine": "添加新条目", "edit": "编辑", "completedEdit": "完成", + "cancelEdit": "取消", "mobileGridHelp": "长按数据区域可编辑数据
向左滑动可以删除数据", "item": "▌条目", "all": "全部",