Game library should return to the page it was on after a page navigation or refresh Fixes #253
* Game library should return to the page it was on after a page navigation or refresh Fixes #253
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
var scrollerElement = document.getElementById('games_filter_scroller');
|
var scrollerElement = document.getElementById('games_filter_scroller');
|
||||||
formatFilterPanel(scrollerElement, result);
|
formatFilterPanel(scrollerElement, result);
|
||||||
|
|
||||||
executeFilter1_1();
|
//executeFilter1_1();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#games_library_orderby_select').select2();
|
$('#games_library_orderby_select').select2();
|
||||||
|
@@ -110,16 +110,30 @@ function formatFilterPanel(containerElement, result) {
|
|||||||
// set order by values
|
// set order by values
|
||||||
var orderByCookie = getCookie('games_library_orderby_select');
|
var orderByCookie = getCookie('games_library_orderby_select');
|
||||||
if (orderByCookie) {
|
if (orderByCookie) {
|
||||||
document.getElementById('games_library_orderby_select').value = orderByCookie;
|
var orderBySelector = document.getElementById('games_library_orderby_select');
|
||||||
|
$(orderBySelector).select2('destroy');
|
||||||
|
$(orderBySelector).val(orderByCookie).select2();
|
||||||
}
|
}
|
||||||
var orderByDirectionCookie = getCookie('games_library_orderby_direction_select');
|
var orderByDirectionCookie = getCookie('games_library_orderby_direction_select');
|
||||||
if (orderByDirectionCookie) {
|
if (orderByDirectionCookie) {
|
||||||
document.getElementById('games_library_orderby_direction_select').value = orderByDirectionCookie;
|
var orderByDirectionSelector = document.getElementById('games_library_orderby_direction_select');
|
||||||
|
$(orderByDirectionSelector).select2('destroy');
|
||||||
|
$(orderByDirectionSelector).val(orderByDirectionCookie).select2();
|
||||||
}
|
}
|
||||||
|
|
||||||
containerElement.appendChild(targetElement);
|
containerElement.appendChild(targetElement);
|
||||||
|
|
||||||
containerElement.appendChild(buttonsDiv);
|
containerElement.appendChild(buttonsDiv);
|
||||||
|
|
||||||
|
console.log('Filter generated - execute filter');
|
||||||
|
var pageNumber = undefined;
|
||||||
|
if (getCookie('games_library_last_page') == "") {
|
||||||
|
pageNumber = undefined;
|
||||||
|
} else {
|
||||||
|
pageNumber = Number(getCookie('games_library_last_page'));
|
||||||
|
}
|
||||||
|
|
||||||
|
executeFilter1_1(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildFilterPanel(targetElement, headerString, friendlyHeaderString, valueList, showToggle, initialDisplay) {
|
function buildFilterPanel(targetElement, headerString, friendlyHeaderString, valueList, showToggle, initialDisplay) {
|
||||||
@@ -381,10 +395,10 @@ function executeFilter1_1(pageNumber, pageSize) {
|
|||||||
var model;
|
var model;
|
||||||
|
|
||||||
// get order by
|
// get order by
|
||||||
var orderBy = document.getElementById('games_library_orderby_select').value;
|
var orderBy = $('#games_library_orderby_select').val();
|
||||||
setCookie('games_library_orderby_select', orderBy);
|
setCookie('games_library_orderby_select', orderBy);
|
||||||
var orderByDirection = true;
|
var orderByDirection = true;
|
||||||
var orderByDirectionSelect = document.getElementById('games_library_orderby_direction_select').value;
|
var orderByDirectionSelect = $('#games_library_orderby_direction_select').val();
|
||||||
if (orderByDirectionSelect == "Ascending") {
|
if (orderByDirectionSelect == "Ascending") {
|
||||||
orderByDirection = true;
|
orderByDirection = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -553,6 +567,7 @@ function executeFilter1_1(pageNumber, pageSize) {
|
|||||||
'POST',
|
'POST',
|
||||||
function (result) {
|
function (result) {
|
||||||
var gameElement = document.getElementById('games_library');
|
var gameElement = document.getElementById('games_library');
|
||||||
|
setCookie('games_library_last_page', pageNumber);
|
||||||
formatGamesPanel(gameElement, result, pageNumber, pageSize, true);
|
formatGamesPanel(gameElement, result, pageNumber, pageSize, true);
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
|
Reference in New Issue
Block a user