sap.m.Wizard: nextStep 在 discardProgress 之后无法正常工作
sap.m.Wizard: nextStep not working correctly after discardProgress
我正在使用 SAPUI5 1.71.1
上下文
向导控件有一个奇怪的问题。当用户返回到上一步并更改影响后续步骤的数据时,必须执行 discardProgress。
SAPUI5 演示套件中提供了一个工作示例:
https://sapui5.hana.ondemand.com/1.71.1/#/entity/sap.m.Wizard/sample/sap.m.sample.WizardBranching
在给定的示例中,如果您转到第 3 步,然后返回第 2 步并更改付款选项,则会出现一个弹出窗口,要求您放弃进度。
然后,出现下一步按钮,您可以再次继续第3步。
我想避免点击下一步按钮,并使用方法 myWizard.nextStep()
自动转到步骤 3。
setDiscardableProperty: function(params) {
if (this._wizard.getProgressStep() !== params.discardStep) {
MessageBox.warning(params.message, {
actions: [MessageBox.Action.YES, MessageBox.Action.NO],
onClose: function(oAction) {
if (oAction === MessageBox.Action.YES) {
this._wizard.discardProgress(params.discardStep);
history[params.historyPath] = this.model.getProperty(params.modelPath);
this._wizard.nextStep(); // not working properly
} else {
// ...
}
}.bind(this)
});
} else {
// ...
}
},
有什么问题?
通常,当您点击下一步按钮时,滚动会引导您进入下一步并隐藏上一步:
但是当你在调用 discardProgress()
后立即使用方法 nextStep()
时,上一步不再隐藏,因为没有触发滚动:
我根据 SAP 提供的示例做了一个 plunk 来帮助您理解问题:https://plnkr.co/edit/1fRmuXOI0m9VuDJq?open=lib%2Fscript.js&preview
看起来像是一个可以修复的错误。* 到那时,无需做太多更改,只需在下一个浏览器事件周期中调用 nextStep
(例如通过 setTimeout
)即可完成工作现在。
this._wizard.discardProgress(params.discardStep);
//...
setTimeout(() => this._wizard.nextStep()); // for UI5 1.73 and below
* 更新: 自 UI5 1.74.0 以来,问题不再重现。
我正在使用 SAPUI5 1.71.1
上下文
向导控件有一个奇怪的问题。当用户返回到上一步并更改影响后续步骤的数据时,必须执行 discardProgress。 SAPUI5 演示套件中提供了一个工作示例: https://sapui5.hana.ondemand.com/1.71.1/#/entity/sap.m.Wizard/sample/sap.m.sample.WizardBranching
在给定的示例中,如果您转到第 3 步,然后返回第 2 步并更改付款选项,则会出现一个弹出窗口,要求您放弃进度。 然后,出现下一步按钮,您可以再次继续第3步。
我想避免点击下一步按钮,并使用方法 myWizard.nextStep()
自动转到步骤 3。
setDiscardableProperty: function(params) {
if (this._wizard.getProgressStep() !== params.discardStep) {
MessageBox.warning(params.message, {
actions: [MessageBox.Action.YES, MessageBox.Action.NO],
onClose: function(oAction) {
if (oAction === MessageBox.Action.YES) {
this._wizard.discardProgress(params.discardStep);
history[params.historyPath] = this.model.getProperty(params.modelPath);
this._wizard.nextStep(); // not working properly
} else {
// ...
}
}.bind(this)
});
} else {
// ...
}
},
有什么问题?
通常,当您点击下一步按钮时,滚动会引导您进入下一步并隐藏上一步:
但是当你在调用 discardProgress()
后立即使用方法 nextStep()
时,上一步不再隐藏,因为没有触发滚动:
我根据 SAP 提供的示例做了一个 plunk 来帮助您理解问题:https://plnkr.co/edit/1fRmuXOI0m9VuDJq?open=lib%2Fscript.js&preview
看起来像是一个可以修复的错误。* 到那时,无需做太多更改,只需在下一个浏览器事件周期中调用 nextStep
(例如通过 setTimeout
)即可完成工作现在。
this._wizard.discardProgress(params.discardStep);
//...
setTimeout(() => this._wizard.nextStep()); // for UI5 1.73 and below
* 更新: 自 UI5 1.74.0 以来,问题不再重现。