o2oa api: application | o2oa开发平台-游戏厅捕鱼达人

class

extends

application 门户中嵌入的系统component对象或网页iframe(模块部署中配置的网页url)。

usable range

portal

example

//可以在脚本中获取该组件
//方法1:
var application = this.form.get("fieldid"); //获取组件
//方法2
var application = this.target; //在组件本身的脚本中获取

source

members

iframeobject

当模块部署中配置的是@url:开头的链接时,嵌入的iframe.

type

  • object

example

var iframe = this.form.get("fieldid").iframe; //获取iframe
iframe.src; //获取iframe的地址

source

componentobject

嵌入的component对象.

type

  • object

example

var app = this.form.get("fieldid").component; //获取component对象
app.recordstatus(); //获取应用的当前状态
app.refresh();      //刷新应用
app.dialog(option); //弹出一个对话框(详见mwf.widget.dialog)
app.notice(content, type, target, where, offset); //显示一个通知消息
app.confirm(type, e, title, text, width, height, ok, cancel); //显示一个确认框
app.alert(type, e, title, text, width, height); //弹出一个信息框
app.addevent(type, fun); //为应用绑定一个事件

source

jsonjsonobject

组件的配置信息,比如id,类型,是否只读等等。可以在组件的queryload事件里修改该配置来对组件做一些改变。

type

  • jsonobject

example

//可以在脚本中获取该组件
var json = this.form.get("fieldid").json; //获取组件对象
var id = json.id; //获取组件的id
var type = json.type; //获取组件的类型,如textfield 为文本输入组件,select为下拉组件
//在组件queryload事件里设置组件只读。
//当前组件的queryload事件运行时还没有在form里注册,通过this.form.get("fieldid")不能获取到当前组件,需要用this.target获取。
var json = this.target.json;
json.isreadonly = true; //设置组件为只读。

source

methods

active(callback)

当组件被设置为延迟激活,通过active方法激活

parameters

  • callback function

    激活后的回调方法(不保证组件加载完成),另外已经激活过该方法还会被执行。

example

var app = this.form.get("fieldid");
app.active(function(){
    //do someting
})

source

loadiframe(src)

加载iframe

parameters

  • src string

    iframe的src,如'https://www.baidu.com/'

example

this.form.get("fieldid").clean(); //清除当前嵌入的对象
this.form.get("fieldid").loadiframe('https://www.baidu.com/'); //加载iframe

source

loadcomponent(path, statusopt, optionsopt)

加载系统组件

parameters

  • path string

    组件的路径,如'calendar'

  • status object

    组件的状态

  • options object

    组件的选项

examples

this.form.get("fieldid").clean(); //清除当前嵌入的对象
this.form.get("fieldid").loadcomponent('calendar'); //加载日程安排
this.form.get("fieldid").clean(); //清除当前嵌入的对象
this.form.get("fieldid").loadcomponent('cms.module', {
 "columnid":"25434995-45d2-4c9a-a344-55ad0deff071"
 }); //加载id为25434995-45d2-4c9a-a344-55ad0deff071的内容管理栏目

source

getcomponentpath(callback)

获取获取表单设计配置的component对象的路径

parameters

  • callback function

    获取路径后的回调方法,参数为路径

example

this.form.get("fieldid").getcomponentpath(function(path){
    //path为路径
})

source

getparentmodule(typeopt, validatefunctionopt) → {mwf.xapplication.process.xform.$module}

获取当前组件所在的祖先组件.

parameters

  • type string

    需要获取的组件类型。 如果该参数省略,则获取离当前组件最近的祖先组件。type有效值如下:

    form- 表单
    common- 通用组件
    datatable- 数据表格
    datatableline- 数据表格行
    datatemplate- 数据模板
    datatemplateline- 数据模板行
    div- 容器组件
    elcommon- element通用组件
    elcontainer- element容器组件
    subform- 子表单
    source- 数据源组件
    subsource- 子数据源
    subsourceitem- 子数据项组件
    tab- 分页组件
    tabpage- 分页组件的某个分页
    table- 表格
    tabletd- 单元格
    widget- 部件
  • validatefunction function

    进一步校验,参数为获取到匹配到类型的组件,返回false继续往上取对应类型的组件,返回true返回该组件。

returns

example

var module = this.target.getparentmodule(); //获取最近的祖先。
var datatemplateline = this.target.getparentmodule("datatemplateline"); //获取当前组件所在的数据模板行.
var module = this.target.getparentmodule(null, function(module){
    return module.json.id === "div_1";
}); //获取当前组件id为div_1的父组件。

source

events

queryloadapplication

component对象初始化后,加载之前触发,this.event可获取component对象。

see

网站地图