Skip to content

Added method reset#149

Open
jonny-no1 wants to merge 2 commits into
rstaib:masterfrom
jonny-no1:patch-reset
Open

Added method reset#149
jonny-no1 wants to merge 2 commits into
rstaib:masterfrom
jonny-no1:patch-reset

Conversation

@jonny-no1

Copy link
Copy Markdown

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

guidolx commented Sep 15, 2015

Copy link
Copy Markdown

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

DevNamedZed commented Nov 3, 2017

Copy link
Copy Markdown

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]))
    {

@jonny-no1

Copy link
Copy Markdown
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