o2oa api: x-游戏厅捕鱼达人

source

mwf.xdesktop.requireapp("process.xform", "$module", null, false);
/** @class sourcetext 数据文本组件。
 * @o2cn 数据文本
 * @example
 * //可以在脚本中获取该组件
 * //方法1:
 * var sourcetext = this.form.get("fieldid"); //获取组件
 * //方法2
 * var sourcetext = this.target; //在组件本身的脚本中获取
 * @extends mwf.xapplication.process.xform.$module
 * @o2category formcomponents
 * @o2range {portal}
 * @hideconstructor
 */
mwf.xapplication.process.xform.sourcetext = mwf.appsourcetext =  new class({
    extends: mwf.app$module,
	_loaduserinterface: function(){
        /**
         * @ignore
         * @member parentline
         * @memberof mwf.xapplication.process.xform.sourcetext#
         */
        this._loadjsondata();
	},
    _getsource: function(){
        var parent = this.node.getparent();
        while(parent && (parent.get("mwftype")!="source" && parent.get("mwftype")!="subsource" && parent.get("mwftype")!="subsourceitem")) parent = parent.getparent();
        return (parent) ? parent.retrieve("module") : null;
    },
    _loadjsondata: function(){
        this.node.set("text", "");
        this.source = this._getsource();
        if (this.source){
            if (this.source.data){
                common.ajaxmodule.load("jsontemplate", function(){
                    this.template = new template();
                    this.text = this.template.substitute("{" this.json.jsonpath "}", this.source.data);
                    if (this.json.jsontext){
                        if (this.json.jsontext.code){
                            this.text = this.form.macro.exec(this.json.jsontext.code, this);
                            if( typeof(this.text) === "string" )this.node.set("text", this.text);
                        }else{
                            this.node.set("text", this.text);
                        }
                    }else{
                        this.node.set("text", this.text);
                    }
                }.bind(this));
            }
        }
    }
}); 
网站地图