I couldn't find a mailing list, so I thought of mentioning it here.
I added this method to window.dhtmlHistory :
{{{ update: function(newLocation, historyData) { historyStorage.put(newLocation, historyData); if (this.isInternetExplorer()) this.iframe.src = "blank.html?" + newLocation; } }}}
update / "update state" similar to add / "add state"
Motivation: my javascript-wizard has several input fields at each step, and the user might expect that the state is saved after changes to each of the fields. At the same time after changing one field, the user would not expect the back-button to undo that last change only.
So call this update method with newLocation chosen the same for each step and historyData updated to reflect new state.
Any comments?
Thanks for the code!
Stephan
Comment #1
Posted on Oct 24, 2007 by Happy LionStephan - interesting suggestions. Can you explain a little bit more what this does that add() doesn't already do? If you call add() using a key (newLocation) that has previously been stored, it will simply update the existing key with your new historyData. You can see this at work in the new test page in the 0.6 beta. Please let me know if I'm missing something here. At the very least I should work the existence of this functionality into the release notes/comments/documentation.
Comment #2
Posted on Oct 25, 2007 by Helpful HippoYes, I forgot to mention -- there is a flicker in the URL bar (sometimes) when using add (not the suggested update) -- in my Firefox. I put together a patch against RSH0.6PC.zip to demonstrate
Stephan
diff RSH0.6/rsh0.6.js RSH0.6update/rsh0.6.js 53a54,59
update: function(newLocation, historyData) { historyStorage.put(newLocation, historyData); // don't know what happened to this function - SW // if (this.isInternetExplorer()) // this.iframe.src = "blank.html?" + newLocation; },
diff RSH0.6/rshTestPage.html RSH0.6update/rshTestPage.html 190a191 var lastAddedLocation 196a198 lastAddedLocation = a[0] 202a205,216
} updateHistoryEvent_I = function() { if(!lastAddedLocation) { alert('No history data to update') return }
testUpdateEntry = 'Add-Update at ' + new Date() dhtmlHistory.add(lastAddedLocation,testUpdateEntry) var msg = "<b>A history event has been added:</b> [newLocation=" +
lastAddedLocation + " | historyData=" + testUpdateEntry + "]"; log(msg, "logDH"); 204a219,229 updateHistoryEvent_II = function() { if(!lastAddedLocation) { alert('No history data to update') return }
testUpdateEntry = 'Update-Update at ' + new Date() dhtmlHistory.update(lastAddedLocation,testUpdateEntry) var msg = "<b>A history event has been added:</b> [newLocation=" +
lastAddedLocation + " | historyData=" + testUpdateEntry + "]"; log(msg, "logDH"); } 281a307,308 | update history - with add | update history - with update
Comment #3
Posted on Oct 28, 2007 by Happy Lion(No comment was entered for this change.)
Comment #4
Posted on Nov 5, 2007 by Happy Lion(No comment was entered for this change.)
Comment #5
Posted on Nov 14, 2007 by Happy Lion(No comment was entered for this change.)
Comment #6
Posted on Jan 3, 2012 by Swift Beargggggggg
Status: Accepted
Labels:
Type-Enhancement
Priority-High