简体   繁体   English

SAPUI5:向导/分支-等待WizardStep完成事件后返回OData

[英]SAPUI5: Wizard / Branching - Wait for OData return on complete Event of WizardStep

my problem is as follows. 我的问题如下。

I have a Wizard in Branching mode. 我在分支模式下有一个向导。 On completing a Step of the Wizard, the complete method is called. 完成向导步骤后,将调用complete方法。 Within this method I send out an OData call to the Backend to determin the NextStep that should be shown. 在此方法中,我向后端发送OData调用以确定应该显示的NextStep。 Hence the call will return the NextStep it is not defined yet and the Framework will Crash with the error, that the NextStep is not defined. 因此,调用将返回尚未定义的NextStep,并且框架将崩溃,并显示错误,即未定义NextStep。

So is there a way to pause/wait/sleep for the return of the OData call without crashing the Framework? 那么,有没有一种方法可以暂停/等待/休眠以返回OData调用而不会导致框架崩溃?

I would appreciate every help. 我将不胜感激。 Thanks! 谢谢!

Example XML: XML示例:

<Wizard id="MainWizard" complete="wizardCompletedHandler" enableBranching="true">
                        <WizardStep id="Step1" title="title" validated="true" subsequentSteps="Step2, Step3" complete="onStepOneComplete"
                            icon="sap-icon://multi-select">

Example onStepOneComplete: onStepOneComplete示例:

onStepOneComplete: function(oEvent) {


        this.getView().getModel().submitChanges();

        var iNextStep = parseInt(this.getView().getModel().getProperty("/SomeSet('123')/NextStep"), 10);

        this.byId("Step1").setNextStep(iNextStep);
    }

Try using the "success" callback of submitChanges 尝试使用submitChanges的“成功”回调

Something like: 就像是:

onStepOneComplete: function(oEvent) {

    var that = this; // needed to keep "this" object in callback
    this.getView().getModel().submitChanges({
        success: function(oResponse){ 
            var iNextStep = parseInt(
                that.getView().getModel().getProperty("/SomeSet('123')/NextStep"), 10
            );

            that.byId("Step1").setNextStep(iNextStep);
        }
    });

}

You can grab the "NextStep" property from the oResponse object instead of the model, but I've left your code for clarity on what exactly I'm suggesting. 您可以从oResponse对象而不是模型中获取“ NextStep”属性,但是为了清楚起见,我离开了您的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM