[英]How to reset a wizard sapui5
I have a wizard that I finish and I want to reset after that and go back to the first step with all other steps invalidated just like it was at first. 我有一个向导完成,我想在此之后重设并返回第一步,所有其他步骤都无效,就像刚开始时一样。 I can reset the model of my data but I always end up in the last step of wizard
我可以重置数据模型,但总是会在向导的最后一步中结束
Call the following code in a function that gets called every time you enter the wizard (not onInit
, this gets called only once, better would be your onRouteMatched
method). 在每次进入向导时都会调用的函数中调用以下代码(不是
onInit
,该onInit
仅被调用一次,最好是onRouteMatched
方法)。
var oWizard = this.byId("myWizard");
var oFirstStep = oWizard.getSteps()[0];
oWizard.discardProgress(oFirstStep);
// scroll to top
oWizard.goToStep(oFirstStep);
// invalidate first step
oFirstStep.setValidated(false);
I guess you are missing the following line to reset progress: 我想您缺少以下行来重置进度:
oWizard.discardProgress(
oWizard.getSteps()[0]
);
Discards all progress done from the given step(incl.) to the end of the wizard.
放弃从给定步骤(包括)到向导结束的所有进度。
See here for the API documentation of the discard function. 有关丢弃函数的API文档,请参见此处 。 The function needs the first wizardStep as a parameter.
该函数需要第一个WizardStep作为参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.