{"action":"created","issue":{"url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/180","labels_url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/180/comments","events_url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/180/events","html_url":"https://github.com/alfajango/jquery-dynatable/issues/180","id":57495089,"number":180,"title":"window.history.state is being overwritten","user":{"login":"hugoduraes","id":1050268,"avatar_url":"https://avatars.githubusercontent.com/u/1050268?v=3","gravatar_id":"","url":"https://api.github.com/users/hugoduraes","html_url":"https://github.com/hugoduraes","followers_url":"https://api.github.com/users/hugoduraes/followers","following_url":"https://api.github.com/users/hugoduraes/following{/other_user}","gists_url":"https://api.github.com/users/hugoduraes/gists{/gist_id}","starred_url":"https://api.github.com/users/hugoduraes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugoduraes/subscriptions","organizations_url":"https://api.github.com/users/hugoduraes/orgs","repos_url":"https://api.github.com/users/hugoduraes/repos","events_url":"https://api.github.com/users/hugoduraes/events{/privacy}","received_events_url":"https://api.github.com/users/hugoduraes/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-12T17:52:55Z","updated_at":"2015-02-25T09:50:13Z","closed_at":null,"body":"Hi,\r\n\r\nWhile working on an app using page.js router, I've noticed that pressing the browser back button to return to a page containing a dynatable with pushState enabled, causes page.js to complain about ```window.history.state.path``` being undefined.\r\n\r\nI guess this happens because Dynatable is overwritting ```window.history.state```. I think the issue is in this piece of code:\r\n\r\n```js\r\ncache = { dynatable: { dataset: settings.dataset } };\r\nif (!firstPush) { cache.dynatable.scrollTop = $(window).scrollTop(); }\r\ncacheStr = JSON.stringify(cache);\r\n\r\n[...]\r\n\r\ntry {\r\n    window.history[pushFunction](cache, \"Dynatable state\", path + params + hash);\r\n} catch(error) {\r\n    // Make cached records = null, so that `pop` will rerun process to retrieve records\r\n    cache.dynatable.dataset.records = null;\r\n    window.history[pushFunction](cache, \"Dynatable state\", path + params + hash);\r\n}\r\n```\r\n\r\nThis can be solved extending the object in ```cache``` variable with ```window.history.state``` value. Like this:\r\n\r\n```js\r\ncache = { dynatable: { dataset: settings.dataset } };\r\nif (!firstPush) { cache.dynatable.scrollTop = $(window).scrollTop(); }\r\n\r\n// added code\r\n$.extend(cache, window.history.state);\r\n// end of added code\r\n\r\ncacheStr = JSON.stringify(cache);\r\n```\r\n\r\nWhat do you think?"},"comment":{"url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/comments/75932863","html_url":"https://github.com/alfajango/jquery-dynatable/issues/180#issuecomment-75932863","issue_url":"https://api.github.com/repos/alfajango/jquery-dynatable/issues/180","id":75932863,"user":{"login":"lello1978","id":6474548,"avatar_url":"https://avatars.githubusercontent.com/u/6474548?v=3","gravatar_id":"","url":"https://api.github.com/users/lello1978","html_url":"https://github.com/lello1978","followers_url":"https://api.github.com/users/lello1978/followers","following_url":"https://api.github.com/users/lello1978/following{/other_user}","gists_url":"https://api.github.com/users/lello1978/gists{/gist_id}","starred_url":"https://api.github.com/users/lello1978/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lello1978/subscriptions","organizations_url":"https://api.github.com/users/lello1978/orgs","repos_url":"https://api.github.com/users/lello1978/repos","events_url":"https://api.github.com/users/lello1978/events{/privacy}","received_events_url":"https://api.github.com/users/lello1978/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T09:50:12Z","updated_at":"2015-02-25T09:50:12Z","body":"I have the same problem.... but i cannot identify where to write your solution. Can you identify line number please.\r\nRegards"}}