Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method reset #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added method reset #149

wants to merge 2 commits into from

Conversation

foaly-nr1
Copy link

Pull request to close issue #26.

Based on: http://stackoverflow.com/a/26848549/2106834.

reset is a reserved word hence why I went for _reset.

@guidolx
Copy link

guidolx commented Sep 15, 2015

A minor fix to the method - imho you could add a check like this - had some weird behaviour on a form where all the steps are enabled (user can navigate back and forth )

if(state.currentIndex !== 0){
    goToStep(wizard, options, state, 0);
}

@DevNamedZed
Copy link

DevNamedZed commented Nov 3, 2017

We have it so they cannot go back after the last page. Added a flag to ignore the stepChanging flag when resetting

$.fn.steps.reset = function () {
    var wizard = this,
        options = getOptions(this),
        state = getState(this);

    
    if (state.currentIndex !== 0) {
        state.isResetting = true;
        goToStep(wizard, options, state, 0);
        state.isResetting = false;
    }

    for (i = 1; i < state.stepCount; i++) {
        var stepAnchor = getStepAnchor(wizard, i);
        stepAnchor.parent().removeClass("done")._enableAria(false);
    }
};
if (state.isResetting || wizard.triggerHandler("stepChanging", [state.currentIndex, index]))
    {

@foaly-nr1
Copy link
Author

This project seems to be abandoned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants