ContentCache for inserted steps
Thanks for a great plugin. Wish I would've found it sooner. Makes my long forms much more readable. :)
I do have an issue when inserting steps: $('#wizard').steps('insert', 1, { title: 'Bla', contentMode: "async", contentUrl: "url to whatever" });
Works just great but when I try to set enableContentCache: true, it still goes in to the if (!options.enableContentCache || !currentStep.contentLoaded) statement in the jquery.steps.js file (line 645). Seems like currentStep.contentLoaded is always false. Is there no way to cache the contents of these inserted steps?
I found a solution:
The flag currentStep.contentLoaded is NOT set to true in the function "loadAsyncContent"
You should add a line:
currentStep.contentLoaded = true;
right before this line (inside the function "loadAsyncContent")
wizard.triggerHandler("contentLoaded", [currentIndex]);
(only 3 years late... hehe)
Only 5 years Late hehe :)
You saved me the trouble of debugging it. Still why haven't this been patched yet? Cheers mate
LE: this solution forcefully caches the current step even if you set the enableContentCache off. Just a side note. LE2: ok here is the complete solution, that seems to work properly even with enableContentCache off. I haven't had a lot of time to debug it so if there is any issue just point it out.
Before this line
wizard.triggerHandler("contentLoaded", [currentIndex]);
Add this.
if( options.enableContentCache ){ currentStep.contentLoaded = true; }
Now go up a bit and change
if (!options.enableContentCache || !currentStep.contentLoaded)
To
if (!currentStep.contentLoaded)
This should enable you to set the enableContentCache on or off, and get a proper control over caching