我有一个包含2个步骤的向导。我想根据第二步中的用户选择向向导添加/删除步骤,并更新向导(向向导添加更多步骤或删除步骤)。尝试从向导中删除步骤后,我将无法正确呈现视图。删除步骤后,我将失去整个视图,向导将显示为空白,没有任何步骤。
bindAggregation
并添加了向导步骤作为模板addWizardStep
添加一个步骤。我的观点:
<Wizard id="idCOEWizard" complete="wizardCompletedHandler" steps="{wizardSteps>/steps}" showNextButton="false">
<WizardStep id="idCOESteps" title="{wizardSteps>stepTitle}" validated="{wizardSteps>validated}" activate="onStepActivate">
<core:Fragment fragmentName="" type="XML"/>
<core:Fragment fragmentName="" type="XML"/>
<core:Fragment fragmentName="" type="XML"/>
</WizardStep>
</Wizard>
步数数据:
{
"steps": [{
"id": "EmployeeDetails",
"stepTitle": "Employee Details",
"validated": true,
"sortOrder": 1,
"viewFrag": "EmployeeDetails"
}, {
"id": "TypeofChange",
"stepTitle": "Type of Change",
"validated": true,
"sortOrder": 2,
"viewFrag": "TypeOfChange"
}]
}
代码:
var aCurrentSteps = this.getView().getModel("wizardSteps").getProperty("/steps");
var oWizardSteps = this.byId("idCOESteps");
for (var i = 0; i < aCurrentSteps.length; i++) {
if (sStep === aCurrentSteps[i].id) {
aCurrentSteps.splice(i);
}
}
this.byId("idCOEWizard").removeAllSteps();
this.byId("idCOEWizard").bindAggregation("steps", {
path: "{wizardSteps>/steps}",
template: oWizardSteps
});
this.byId("idCOEWizard").discardProgress(this.byId("idCOEWizard").getSteps()[0]);
this.getView().getModel("wizardSteps").refresh(true);