Search code examples
javascriptsapui5wizard

SAPUI5: Wizard goToStep() method is not working


I am using SAPUI5 Wizard for my company project but it is not working for me for some reason.

Here's my code:

var allSteps = oWizardElement.getSteps();
var stepOne = allSteps[0];
var stepTwo = allSteps[1];
var stepThree = allSteps[2];
    if (iActiveStep === 1) {
        oWizardElement.goToStep(stepThree, false);
    }

After I ran the code, the entire wizard is broken. Including the header with step 1, steo 2, and step 3 buttons are off... When I checked the error, in the console it says

/webapp/resources/sap/m/library-preload.json/sap/m/WizardProgressNavigator.js:6 Uncaught TypeError: Cannot read property 'setAttribute' of undefined

Could someone please guide me what's wrong in my code?

Here's the sources I found in the SAPUI5 documentation: https://sapui5.hana.ondemand.com/docs/api/symbols/sap.m.Wizard.html#getSteps


Solution

  • As the documentation say the step you are going to need to be activated. You should have already reached "stepThree" before otherwise gotostep() will not work.