isLoaded (客户端 API 参考)

返回快速视图控件中构成控件的数据绑定是否已完成。

Syntax

quickViewControl.isLoaded();

返回值

类型:布尔值。

说明:true 是构成控件的数据绑定已完成;否则为 false。

注解

快速视图控件中构成控件的数据绑定可能无法在主窗体 OnLoad 事件期间完成,因为该控件绑定到的快速视图窗体可能无法加载。 因此,对构成控件使用 getAttribute 或任何与数据相关的方法可能不起作用。 快速视图控件的 isLoaded 方法有助于确定快速视图控件中构成控件的数据绑定状态。

Example

下面的示例代码演示如何使用 isLoaded 方法检查绑定状态,然后检索快速视图控件中构成控件绑定到的列的值。

function getAttributeValue(executionContext) {
    var formContext = executionContext.getFormContext();
    var quickViewControl = formContext.ui.quickForms.get("<QuickViewControlName>");
    if (quickViewControl != undefined) {
        if (quickViewControl.isLoaded()) {
            // Access the value of the column bound to the constituent control
            var myValue = quickViewControl.getControl(0).getAttribute().getValue();
            console.log(myValue);
            
            // Search by a specific column present in the control
            var myValue2 =  quickViewControl.getControl().find(control => control.getName() == "<AttributeSchemaName>").getAttribute().getValue();
            console.log(myValue2);
            
            return;
        }
    }
    else {
        console.log("No data to display in the quick view control.");
        return;
    }
}

formContext.ui.quickForms