Hallo,
I am looking for a way to switch from Grid to List or Text View, while being in a session. For this I added 3 Links into the pagination.jsp
div>
a id="switchGrid" href="#" class="glyphicon glyphicon-th"> /a>
a id="switchList" href="#" class="glyphicon glyphicon-th-list"> /a>
a id="switchText" href="#" class="glyphicon glyphicon-align-justify"> /a>
/div>
(for some reason I cannot add the <) And I created following javascript
$('#switchGrid').click(
function(e) {
e.preventDefault(); // prevent the default action
e.stopPropagation(); // stop the click from bubbling
$('#pgc').removeClass().addClass('product__listing product__grid');
$('#srgc').removeClass().addClass('product__listing product__grid');
return false;
}
);
$('#switchList').click(
function(e) {
e.preventDefault(); // prevent the default action
e.stopPropagation(); // stop the click from bubbling
$('#pgc').removeClass().addClass('product__listing product__list');
$('#srgc').removeClass().addClass('product__listing product__list');
return false;
}
);
$('#switchText').click(
function(e) {
e.preventDefault(); // prevent the default action
e.stopPropagation(); // stop the click from bubbling
$('#pgc').removeClass().addClass('product__listing product__text');
$('#srgc').removeClass().addClass('product__listing product__text');
return false;
}
);
The problem here is, that this is temporary. if the user goes to the new page or refreshes the page, then it will be resetted.
Is it possible to add a variable like 'pageView' into the session, change it in javascript and read it in jsp? In that case I could check if pageView is list, grid or text.
Thanks in advance.
Best regards, Serdar