view

view(container)

使用范围: client

编程语言: javascript

父类: Item 类

描述说明

使用 view 方法创建实体项的一个视图表单窗体。

该方法会检查实体项及其父项的 javascript 模块是否已被加载,如果没有(项目的参数 中设置了 “动态加载 JS 模块” ),就加载它们。

如果指定了 container 参数( DOM 元素的 Jquery 对象),视图表单窗体的 html 模板将被插入到容器(conainer)中。

如果调用了 “任务(task)” 的 init_tabs 方法,将为窗体创建选项卡。

以上完成以后,将调用 create_view_form 方法。

示例

In the following code the view for of the Tasks journal is created in the on_page_loaded event handler:

function on_page_loaded(task) {

    $("#title").html(task.item_caption);
    if (task.safe_mode) {
        $("#user-info").text(task.user_info.role_name + ' ' + task.user_info.user_name);
        $('#log-out')
        .show()
        .click(function(e) {
            e.preventDefault();
            task.logout();
        });
    }

    task.init_tabs($("#content"));
    task.tasks.view($("#content"));

    $(window).on('resize', function() {
        resize(task);
    });
}

另请参见

表单窗体

view_form

view_options

create_view_form

close_view_form