realcrowd / angularjs-utilities

Hopefully useful directives, providers, filters, etc for AngularJS
Other
199 stars 50 forks source link

Subsequent open of the wizard is always going to the page where we left on previous open #14

Open sudheerp opened 9 years ago

sudheerp commented 9 years ago

Firstly, thanks for the wonderful wizard utility. It really eased lot of complexity for the users.

Actually we are using the wizard within a pop-up. When we open first time, all is good as it is opening with first form. But subsequent open is always going to the page where we left on previous open. I am trying to solve this by pointing to the first page while opening the wizard, but without luck. Any help or pointers will be helpful.

Really appreciate your help.

kglee79 commented 9 years ago

I was able to get around this by removing the "active" class via JQuery from all pages except the first. For instance $('#firstForm').addClass("active") to set the active form to the first page and $('#otherForm').removeClass("active") to make them inactive. Also, in order for the steps at the top to be correct you will need to remove the "success" and "active" classes from the list items and then add the "active" class back to the first list item.

$('.rc-nav-wizard li').removeClass("success").removeClass("active");
$('.rc-nav-wizard li:nth-child(1)').addClass("active");

I am still having trouble getting the "Complete" button to reset though. If you go all the way to the last page where the complete button shows and then exit the modal, then go back in, it will show the complete button on the first page instead of the continue button. I've tried $('#rootwizard').data('bootstrapWizard').resetWizard(); which correctly changes the currentIndex back to the first page, but the complete button is still showing.

kglee79 commented 9 years ago

Just figured it out. Instead of doing any of what I mentioned in the previous post, I simply did the following to reset the wizard and go back to the first page.

$('#rootwizard').data('bootstrapWizard').resetWizard();
$('#rootwizard').data('bootstrapWizard').show(0);