Open Merwer opened 8 years ago
Merwer,
It creates 4 entries because the structureHash gets updated when the DT API events fire, and some of them run frequently (eg: the search runs on key up, I believe).
And the fix you provided looks like a good idea, ill implement that asap. However, I think it would need to be: window.history.replaceState(undefined, undefined, '#' + (newHash || null)
to prefix the the hash with a prefix. If the 3rd parameter is an underscore, it adds an underscore with no hash
Also, what would you think about me adding a new config setting, something like updateInterval
, or updatePause
, which would only update the URL every N seconds, so if you type "t-e-s-t" into the search box, it would want N
seconds to update the URL. what do you think?
I think it's not a bad idea - it would certainly decrease the amount of history updates & local storage writes. However, I would also say that it's likely a feature that would get unused; changing the JS to update the history instead of adding to it would pretty much negate any issues that I can think of that would be caused by this.
You already have something similar to delay the searching - I would personally say adding an additional timer for the history updates is a bit of overkill.
On 8 August 2016 at 12:28, J notifications@github.com wrote:
Merwer,
It creates 4 entries because the structureHash gets updated when the DT API events fire, and some of them run frequently (eg: the search runs on key up, I believe).
And the fix you provided looks like a good idea, ill implement that asap.
Also, what would you think about me adding a new config setting, something like updateInterval, or updatePause, which would only update the URL every N seconds, so if you type "t-e-s-t" into the search box, it would want N seconds to update the URL. what do you think?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jhyland87/DataTables-Keep-Conditions/issues/4#issuecomment-238291776, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWJ3xdrsT8wKQpraMQIRsNfddQV32jKks5qd1lDgaJpZM4IWej_ .
It'd be nice to have an option to turn on/off the creation of browser history entries. Unless I'm missing something, right now, when I type "t-e-s-t" into the global search input field, I get 4 entries into my browser history. This means that I'll have to hit the back button 4 times to actually go back to my previous page.
The most obvious fix would be to modify structureHash:322 and change
window.location.hash = newHash || '_'
towindow.history.replaceState(undefined, undefined, newHash || '_')
. This would manipulate the browser history and change the 'current' entry to be the new URL.More info: