Commit 3e87f74e authored by unknown's avatar unknown
Browse files

api添加getSource和currentEditedLine

parent 351cc0f5
Showing with 51 additions and 0 deletions
+51 -0
......@@ -80,6 +80,29 @@ MWF.xApplication.process.Xform.$Module = MWF.APP$Module = new Class(
*/
this.parentLine = null;
},
/**
* 当前组件在数据源组件中时,可以通过此方法获取所在的上级数据源/子数据源/子数项组件.
* @param {String} [type] 需要获取的类型,"source"为表示数据源,"subSource"表示子数据源,"subSourceItem"表示子数据项组件。
* 如果该参数省略,则获取离当前组件最近的上述组件。
* @return {MWF.xApplication.process.Xform.Source|MWF.xApplication.process.Xform.SubSource|MWF.xApplication.process.Xform.SubSourceItem}。
* @example
* var source = this.target.getSource(); //获取当前组件的所在子上级数据源/子数据源/子数项组件.
* var data = source.data; //获取数据源的值
*
* var source = this.form.get("fieldId").getSource("source"); //获取数据源组件
* var data = source.data; //获取数据源的值
*/
getSource: function( type ){
if( type ){
var parent = this.node.getParent();
while(parent && parent.get("MWFtype")!= type ){
parent = parent.getParent();
}
return (parent) ? parent.retrieve("module") : null;
}else{
return this._getSource();
}
},
_getSource: function(){
var parent = this.node.getParent();
while(parent && (
......
......@@ -789,6 +789,22 @@ MWF.xApplication.process.Xform.DatatablePC = new Class(
if( !this._completeLineEdit() )return;
}
line.changeEditMode(true);
/**
* 数据表格当前正在编辑的条目,当数据表格为“同时编辑多行”时无此属性。
* @member {MWF.xApplication.process.Xform.DatatablePC.Line | MWF.xApplication.process.Xform.DatatableMobile.Line | Null}
* @example
* //获取数据表格“dt1”的正在编辑的条目。
* var line = this.form.get("dt1").currentEditedLine;
* //获取数据
* var data = line.getData();
* //设置数据
* line.setData({"subject":"111"});
* //获取subject字段的值
* var data = line.get("subject").getData();
* //设置subject字段的值
* line.get("subject").setData("test1");
*/
this.currentEditedLine = line;
},
......
......@@ -109,6 +109,12 @@ MWF.xApplication.process.Xform.Source = MWF.APPSource = new Class(
},
_invoke: function(callback){
MWF.restful(this.json.httpMethod, this.uri, JSON.encode(this.body), function(json){
/**
* @summary 该属性获取当前数据源的数据,当数据源加载完成后才有值。
* @member {Array|Object|String|Number|Boolean|Null}
* @example
* var field = this.form.get("fieldId").data; //获取数据源数据
*/
this.data = json;
this.fireEvent("postLoadData");
if (callback) callback();
......
......@@ -75,6 +75,12 @@ MWF.xApplication.process.Xform.SubSource = MWF.APPSubSource = new Class(
data = data[p];
}.bind(this));
}
/**
* @summary 该属性获取当前子数据源的数据,当所在上级数据源加载完成后才有值。
* @member {Array|Object|String|Number|Boolean|Null}
* @example
* var field = this.form.get("fieldId").data; //获取子数据源数据
*/
this.data = data;
},
_loopSub: function(dom, i){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment