Filter not working

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Filter not working

Post by malcmail »

Been using a version of 2.18 for a while with a lot of changes to it. All of a sudden, out of nowhere, when I click on any of the filter headings nothing happens. No dropdown box below them, nothing. Search still works but the filters would be more useful. Does anyone have any ideas what might have happened? I didn't make any changes in the last few months yet it seems to have stopped working in that time.

Thanks in advance.
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter not working

Post by atrol »

Check your browser console for any errors or warnings.
Please use Search before posting and read the Manual
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Re: Filter not working

Post by malcmail »

Thanks for that. Seeing a few errors.

Refused to load image xxxxxxxxx because it violates the following Content Security Policy directive: "img-src 'self'" accounts for 6 of them but that doesn't appear to be the issue. On cllicking one of the headings that should give me a dropdown it give:
Uncaught ReferenceError: translations is not defined
at HTMLAnchorElement.<anonymous> (common.js:128)
at HTMLAnchorElement.dispatch (jquery-2.2.4.min.js:3)
at HTMLAnchorElement.r.handle (jquery-2.2.4.min.js:3)

At this point in time, bit out of my depth!! I've not changed a thing on my server since it was working OK.
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Re: Filter not working

Post by malcmail »

Seems the issue is in js/common.js with this bit of script:

Code: Select all

$('a.dynamic-filter-expander').click(function(event) {
		event.preventDefault();
		var fieldID = $(this).attr('id');
		var filter_id = $(this).data('filter_id');
		var filter_tmp_id = $(this).data('filter');
		var targetID = fieldID + '_target';
		var viewType = $('#filters_form_open input[name=view_type]').val();
		$('#' + targetID).html('<span class="dynamic-filter-loading">' + translations['loading'] + "</span>");
		var params = 'view_type=' + viewType + '&filter_target=' + fieldID;
		if( undefined !== filter_id ) {
			params += '&filter_id=' + filter_id;
		}
		if( undefined !== filter_tmp_id ) {
			params += '&filter=' + filter_tmp_id;
		}
		$.ajax({
			url: 'return_dynamic_filters.php',
			data: params,
			cache: false,
			context: $('#' + targetID),
			success: function(html) {
				$(this).html(html);
			},
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter not working

Post by atrol »

Check with browser networks tools.
There should be something like the marked line, and as response the translations['loading'] (see right part of the scrennshot.
Network.jpg
Network.jpg (288.23 KiB) Viewed 4809 times
Please use Search before posting and read the Manual
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Re: Filter not working

Post by malcmail »

This is going to sound like a basic question but how do I get that open?
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter not working

Post by atrol »

You have to open the developer tools of your browser, e,g Ctrl+Shift+I for Firefox on Windows or use the Extras menu for it.
Please use Search before posting and read the Manual
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Re: Filter not working

Post by malcmail »

Thanks. Swapped to firefox so that I could match against yours (was having no joy in Chrome).

I have the same info as you after clicking on one of the filter headings but also something rather weird. It appears some extra text crept into a file which I've now removed. But the server still seems to be offering that particular version up. Different browser on original PC and all is well. Same browser as before and same problem (Chrome - although I can get developer tools up I can't get the list of requests or responses)
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter not working

Post by atrol »

It works when using Firefox but not when using Chrome?

If so, clearing browser cache in Chrome might fix the issue.
Please use Search before posting and read the Manual
malcmail
Posts: 17
Joined: 22 Nov 2018, 14:05

Re: Filter not working

Post by malcmail »

Perfect - sorted it. Thanks very much for the help.
Post Reply