As the user changes filters values on my page I am updating the pages URL using the following:
function filterChanged() {
window.history.pushState("", document.title, '?' + $("#FiltersForm").serialize())
}
This appears to work as the URL becomes:
http://localhost/?CreatedDate=2016-11-07&StatusFilter=Complete&StatusFilter=Failed
(note this is an MVC project)
If I then refresh the page using F5 or Enter in the address bar it reloads and the text/date inputs and selects keep their value. The check boxes don't.
Am I missing something or is this one of those things that has to be done manually by parsing the query string?
Check box HTML:
<input type="checkbox" class="StatusFilterCheckBox" data-status-filter="Pending" name="StatusFilter" value="Pending" onchange="filterChanged()">
<input type="checkbox" class="StatusFilterCheckBox" data-status-filter="Failed" name="StatusFilter" value="Failed" onchange="filterChanged()">
<input type="checkbox" class="StatusFilterCheckBox" data-status-filter="Complete" name="StatusFilter" value="Complete" onchange="filterChanged()">