|
|
@@ -40,15 +40,24 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
if (this.editable!=false){
|
|
|
this._loadDatagridDataModules();
|
|
|
//this._addTitleActionColumn();
|
|
|
- this._loadEditDatagrid();
|
|
|
- //this._loadReadDatagrid();
|
|
|
- this.fireEvent("postLoad");
|
|
|
- this.fireEvent("load");
|
|
|
+ // this._loadEditDatagrid();
|
|
|
+ // //this._loadReadDatagrid();
|
|
|
+ // this.fireEvent("postLoad");
|
|
|
+ // this.fireEvent("load");
|
|
|
+ this._loadEditDatagrid(function(){
|
|
|
+ this.fireEvent("postLoad");
|
|
|
+ this.fireEvent("load");
|
|
|
+ }.bind(this));
|
|
|
}else{
|
|
|
this._loadDatagridDataModules();
|
|
|
- this._loadReadDatagrid();
|
|
|
- this.fireEvent("postLoad");
|
|
|
- this.fireEvent("load");
|
|
|
+ this._loadReadDatagrid(function(){
|
|
|
+ this.fireEvent("postLoad");
|
|
|
+ this.fireEvent("load");
|
|
|
+ }.bind(this));
|
|
|
+
|
|
|
+ // this._loadReadDatagrid();
|
|
|
+ // this.fireEvent("postLoad");
|
|
|
+ // this.fireEvent("load");
|
|
|
}
|
|
|
},
|
|
|
createMobileTable: function(){
|
|
|
@@ -90,14 +99,18 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
|
|
|
},
|
|
|
_getValue: function(){
|
|
|
+ if (this.moduleValueAG) return this.moduleValueAG;
|
|
|
var value = [];
|
|
|
value = this._getBusinessData();
|
|
|
if (!value){
|
|
|
if (this.json.defaultData && this.json.defaultData.code) value = this.form.Macro.exec(this.json.defaultData.code, this);
|
|
|
- value = {"data": value || []};
|
|
|
+ if (!value.isAG) if (o2.typeOf(value)=="array") value = {"data": value || []};
|
|
|
}
|
|
|
return value || [];
|
|
|
},
|
|
|
+ getValue: function(){
|
|
|
+ return this._getValue();
|
|
|
+ },
|
|
|
|
|
|
_getValueText: function(idx, value){
|
|
|
var module = this.editModules[idx];
|
|
|
@@ -157,6 +170,12 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
return value;
|
|
|
}
|
|
|
break;
|
|
|
+ case "Textarea":
|
|
|
+ var reg = new RegExp("\n","g");
|
|
|
+ var reg2 = new RegExp("\u003c","g"); //尖括号转义,否则内容会截断
|
|
|
+ var reg3 = new RegExp("\u003e","g");
|
|
|
+ value = value.replace(reg2,"<").replace(reg3,">").replace(reg,"<br/>");
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return value;
|
|
|
@@ -173,8 +192,22 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
return flag;
|
|
|
},
|
|
|
|
|
|
- _loadReadDatagrid: function(){
|
|
|
- this.gridData = this._getValue();
|
|
|
+ _loadReadDatagrid: function(callback){
|
|
|
+ if (this.gridData && this.gridData.isAG){
|
|
|
+ this.moduleValueAG = this.gridData;
|
|
|
+ this.gridData.addResolve(function(v){
|
|
|
+ this.gridData = v;
|
|
|
+ this._loadReadDatagrid(callback);
|
|
|
+ }.bind(this));
|
|
|
+ }else{
|
|
|
+ if (o2.typeOf(this.gridData)=="array") this.gridData = {"data": this.gridData};
|
|
|
+ this.__loadReadDatagrid(callback);
|
|
|
+ this.moduleValueAG = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ __loadReadDatagrid: function(callback){
|
|
|
+ //this.gridData = this._getValue();
|
|
|
|
|
|
var titleHeaders = this.table.getElements("th");
|
|
|
var tds = this.table.getElements("td");
|
|
|
@@ -215,7 +248,12 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
this._createImage( cell, module, v )
|
|
|
}else{
|
|
|
text = this._getValueText(index, v);
|
|
|
- cell.set("text", text);
|
|
|
+ if( module && module.json.type == "Textarea" ){
|
|
|
+ cell.set("html", text);
|
|
|
+ }else{
|
|
|
+ cell.set("text", text);
|
|
|
+ }
|
|
|
+ //cell.set("text", text);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -247,13 +285,28 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
}.bind(this));
|
|
|
}.bind(this));
|
|
|
}
|
|
|
-
|
|
|
+ if (callback) callback();
|
|
|
//this._loadTotal();
|
|
|
},
|
|
|
- _loadEditDatagrid: function(){
|
|
|
+
|
|
|
+ _loadEditDatagrid: function(callback){
|
|
|
+ debugger;
|
|
|
+ if (this.gridData && this.gridData.isAG){
|
|
|
+ this.moduleValueAG = this.gridData;
|
|
|
+ this.gridData.addResolve(function(v){
|
|
|
+ this.gridData = v;
|
|
|
+ this._loadEditDatagrid(callback);
|
|
|
+ }.bind(this));
|
|
|
+ }else{
|
|
|
+ if (o2.typeOf(this.gridData)=="array") this.gridData = {"data": this.gridData};
|
|
|
+ this.__loadEditDatagrid(callback);
|
|
|
+ this.moduleValueAG = null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ __loadEditDatagrid: function(callback){
|
|
|
//this._createHelpNode();
|
|
|
|
|
|
- this.gridData = this._getValue();
|
|
|
+ //this.gridData = this._getValue();
|
|
|
|
|
|
var titleHeaders = this.table.getElements("th");
|
|
|
var tds = this.table.getElements("td");
|
|
|
@@ -297,7 +350,13 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
this._createImage( cell, module, v )
|
|
|
}else{
|
|
|
text = this._getValueText(index, v);
|
|
|
- cell.set("text", text);
|
|
|
+ if( module && module.json.type == "Textarea" ){
|
|
|
+ cell.set("html", text);
|
|
|
+ }else{
|
|
|
+ cell.set("text", text);
|
|
|
+ }
|
|
|
+
|
|
|
+ //cell.set("text", text);
|
|
|
}
|
|
|
|
|
|
// if (typeOf(v)==="object"){
|
|
|
@@ -338,6 +397,7 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
}
|
|
|
// this._loadAddAction();
|
|
|
}
|
|
|
+ if (callback) callback();
|
|
|
//this._loadTotal();
|
|
|
},
|
|
|
_loadActions: function(titleDiv){
|
|
|
@@ -676,13 +736,19 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
}
|
|
|
|
|
|
var cell;
|
|
|
+ var text = this._getValueText(idx, data.text.join(", "));
|
|
|
+
|
|
|
if (dataRow){
|
|
|
cell = dataRow.getElement("td");
|
|
|
-
|
|
|
if( module.json.type == "ImageClipper" ){
|
|
|
this._createImage( cell, module, data.text );
|
|
|
}else{
|
|
|
- cell.set("text", data.text.join(", "));
|
|
|
+ if( module && module.json.type == "Textarea" ){
|
|
|
+ cell.set("html", text);
|
|
|
+ }else{
|
|
|
+ cell.set("text", text);
|
|
|
+ }
|
|
|
+ //cell.set("text", data.text.join(", "));
|
|
|
}
|
|
|
}else{
|
|
|
dataRow = table.insertRow(idx);
|
|
|
@@ -697,7 +763,12 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
if( module.json.type == "ImageClipper" ){
|
|
|
this._createImage( cell, module, data.text );
|
|
|
}else{
|
|
|
- cell.set("text", data.text.join(", "));
|
|
|
+ if( module && module.json.type == "Textarea" ){
|
|
|
+ cell.set("html", text);
|
|
|
+ }else{
|
|
|
+ cell.set("text", text);
|
|
|
+ }
|
|
|
+ //cell.set("text", data.text.join(", "));
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
@@ -1128,13 +1199,33 @@ MWF.xApplication.process.Xform.DatagridMobile = new Class({
|
|
|
this.setData(this._getValue());
|
|
|
},
|
|
|
setData: function(data){
|
|
|
- // if( typeOf( data ) === "object" && typeOf(data.data) === "array" ){
|
|
|
- if (data){
|
|
|
- this._setBusinessData(data);
|
|
|
- this.gridData = data;
|
|
|
+ if (!data){
|
|
|
+ data = this._getValue();
|
|
|
+ }
|
|
|
+ this._setData(data);
|
|
|
+ },
|
|
|
+ _setData: function(data){
|
|
|
+ if (data && data.isAG){
|
|
|
+ this.moduleValueAG = data;
|
|
|
+ data.addResolve(function(v){
|
|
|
+ this._setData(v);
|
|
|
+ }.bind(this));
|
|
|
}else{
|
|
|
- this.gridData = this._getValue();
|
|
|
+ if (o2.typeOf(data)=="array") data = {"data": data};
|
|
|
+ this.__setData(data);
|
|
|
+ this.moduleValueAG = null;
|
|
|
}
|
|
|
+ },
|
|
|
+ __setData: function(data){
|
|
|
+ // if( typeOf( data ) === "object" && typeOf(data.data) === "array" ){
|
|
|
+ // if (data){
|
|
|
+ // this._setBusinessData(data);
|
|
|
+ // this.gridData = data;
|
|
|
+ // }else{
|
|
|
+ // this.gridData = this._getValue();
|
|
|
+ // }
|
|
|
+ this._setBusinessData(data);
|
|
|
+ this.gridData = data;
|
|
|
|
|
|
// if (this.isEdit) this._completeLineEdit();
|
|
|
if( this.isEdit ){
|
|
|
@@ -1466,4 +1557,4 @@ MWF.xApplication.process.Xform.DatagridMobile$Data = new Class({
|
|
|
}.bind(this));
|
|
|
}
|
|
|
}
|
|
|
-});
|
|
|
+});
|