如何确定SmartForms是构建的?

时间:2018-11-29 12:42:59

标签: sapui5

我有一个如下所示的SmartForm:

<Dialog id="massChangeDialog" title="{i18n>ChangeMaintainanceOrderOperation}" resizable="true" draggable="true" contentWidth="900px"
    contentHeight="700px">
    <content>
        <smartForm:SmartForm id="editOperation" editable="true" entityType="EditOperation">
            <smartForm:Group>
                <smartForm:GroupElement>
                    <smartField:SmartField value="{WorkCenter}" id="idWorkCenter" width="90%" class="sapUiSmallMarginBottom"/>
                </smartForm:GroupElement>
            </smartForm:Group>
            <smartForm:Group>
                <smartForm:GroupElement>
                    <smartField:SmartField value="{PersonalNumber}" id="idPersonalNr" width="90%"/>
                </smartForm:GroupElement>
            </smartForm:Group>
            <smartForm:Group>
                <smartForm:GroupElement>
                    <smartField:SmartField value="{ActionDescription}" width="90%" id="idDispatch"/>
                </smartForm:GroupElement>
            </smartForm:Group>
            <smartForm:Group>
                <smartForm:GroupElement>
                    <smartField:SmartField value="{ChangedDate}" id="idDate" width="90%"/>
                </smartForm:GroupElement>
            </smartForm:Group>
            <smartForm:Group>
                <smartForm:GroupElement>
                    <smartField:SmartField value="{ChangedTime}" id="idTime" width="90%" placeholder="{i18n>EnterTime}"/>
                </smartForm:GroupElement>
            </smartForm:Group>
        </smartForm:SmartForm>
    </content>
</Dialog>

如您所见,SmartForm位于对话框内。当我调用open方法并想访问SmartField时,我得到了undefined
代码如下:

首先,我创建了一个Dialog实例

if (!this.oDialogChangeOperations) {
    // Begin of 0001
    this.oDialogChangeOperations = sap.ui.xmlfragment(this.getView().getId(),
        "rsh.eam.details1.RSH_EAM_DETS1Extension.view.ChangeOperationsCustom", this);
    // End of 0001
    //this.getView().addDependent(this.oDialogChangeOperations);
    this.oDialogChangeOperations.setModel(this.getModel("EditOp"));
    this.oDialogChangeOperations.setModel(this.getView().getModel(), "Origin");
    this.oDialogChangeOperations.setModel(this.getView().getModel("i18n"), "i18n");

    this.byId("MassChange").attachPress(this.onMassChangePressed, this);
} 

this.oDialogChangeOperations.bindElement("/EditOperationSet(1)");
this._openChangeDialog();

最后,我调用了函数 _openChangeDialog 来打开对话框:

_openChangeDialog: function () {
    if (!this.oDialogChangeOperations.isOpen()) {
        // Pre-setting the filter values
        this.oDialogChangeOperations.open();
        // Deregister this event - no more is it needed
        this.initialWorkCenter = this.byId("idWorkCenter").getBindingContext().getObject().WorkCenter;
        this.intialStatus = this.byId("idDate").getBindingContext().getObject().ActionDescription;
        this.intialPerson = this.byId("idPersonalNr").getBindingContext().getObject().PersonalNumber;
    }
},

在线:

this.initialWorkCenter = this.byId("idWorkCenter").getBindingContext().getObject().WorkCenter;

我有undefined,因为该服务尚未加载。
为了澄清,我的意思是,我在_openChangeDialog函数中设置了一个断点:

enter image description here

,您会看到打开对话框后SmartForm没有出现。

几秒钟后,出现SmartForm

enter image description here

初始化SmartForm时是否有一个我可以捕获的事件。

0 个答案:

没有答案