JTe
New Member
When accessing the full page details view from a filtered list (Filters->Filters = Pop-up, Navigation->Ajaxify = Yes, Links->Ajaxify Links=No) and returning with the "Back" button all the filtering will be lost and the list displayed unfiltered.
This happens because the Back-button jumps to a direct list url and reloads the list and resets all filters.
To resolve this we could set the Back button to history.back when coming from the list page. If the details page is accessed from other locations the old functionality should be kept to make the functionality consistent to end users.
What we can do is after the dom has loaded check if we did land to the Details page from our list url and if so change the Back button to history.back(), otherwise make it a direct link to our list.
This can be done by adding the file (where XX is your Details view number):
The above javascript is triggered after the dom is ready. We will then replace the Back-button with a code that is replacing the original event of the Back-button with our new event. Above we are checking if we are coming from our domain, but you can also check if we come exactly from our list url:
Then according to from where we landed on the Details page we will select our action -either history.back() or a direct link.
This happens because the Back-button jumps to a direct list url and reloads the list and resets all filters.
To resolve this we could set the Back button to history.back when coming from the list page. If the details page is accessed from other locations the old functionality should be kept to make the functionality consistent to end users.
What we can do is after the dom has loaded check if we did land to the Details page from our list url and if so change the Back button to history.back(), otherwise make it a direct link to our list.
This can be done by adding the file (where XX is your Details view number):
Code:
components/com_fabrik/js/details_XX.js
JavaScript:
window.addEvent('domready',function() {
document.querySelector('button[name=Goback]').onclick = function(evt) {
evt.preventDefault(); // Cancel the original event
if(document.referrer.split('/')[2]=='my.domain.com'){
onclick = window.history.back();
} else {
location.href = 'https://my.domain.com/list';
}
};
})
The above javascript is triggered after the dom is ready. We will then replace the Back-button with a code that is replacing the original event of the Back-button with our new event. Above we are checking if we are coming from our domain, but you can also check if we come exactly from our list url:
JavaScript:
if(document.referrer=='https://my.domain.com/list')