Element filters stop working after pressing Clear Filters button in ajaxify list

rider

Member
Hello,

This is my first post here, so, before anything else, congratulations for your excellent component and ...sorry for my English:(

Now, here is the problem:
List config:
- Ajaxify on
- Filter trigger: submit button or on change

All elements filters work ok before first pressing of ?Clear filters? button, as you can see in Jing video.

http://www.screencast.com/t/aBXYUULbA

In my Post headers request, on Chrome, I have this Form data, before and after clearing filters.

I have no javascript errors in firebug or PHP errors in my logs.

Can anyone confirm that this is a bug or I have this problem only on my system?

Thank you!
 

Attachments

  • filters_apllied.jpg
    filters_apllied.jpg
    122.3 KB · Views: 245
  • filters_missing.jpg
    filters_missing.jpg
    110.5 KB · Views: 245
I just did an update from Github and now all filters stop working and Firebug shows the following error in list.js (line 602)
This is the block of code:

Code:
doFilter: function () { 
var res = Fabrik.fireEvent('list.filter', [this]).eventResults; 
if (res.length === 0 || !res.contains(false)) { 
this.submit('list.filter'); 
} 
}
 

Attachments

  • list_error.jpg
    list_error.jpg
    14.2 KB · Views: 231
Related to the second problem above, I found this:

In file media/com_fabrik/js/fabrik.js , if line 257
Code:
this.eventResults = [];
is inserted before line 251
Code:
if (!events || !events[type]) {
filters work again and the final code look like this:
Code:
Fabrik.fireEvent = function (type, args, delay) {
			var events = Fabrik.events;
			this.eventResults = [];
			if (!events || !events[type]) {
				return this;
			}
			args = Array.from(args);
			
			// An array of returned values from all events.
			// this.eventResults = [];
			events[type].each(function (fn) {
				if (delay) {
					this.eventResults.push(fn.delay(delay, this, args));
				} else {
					this.eventResults.push(fn.apply(this, args));
				}
			}, this);
			return this;
		};


But the first problem is still there? :(

Thank you
 
Hello,

This is not a bump, is a .... gentle, gentle, gentle bump :)

I just need a confirmation if the problem mentioned in the first post is a real bug or not.

Can anybody help me, I tried everything I now to debug the code but my programming skills are pretty limited?

Thank you very much
 
After running some more tests I discovered that this problem is only specific to element filters (under headings / above), and in ?search all? field everything works ok.

If I set for an element filter ?Include in search all: yes?, then, after the filters are reset, searching in ?search all? field works ok but searching in element search field not .
 
Apologies for not responding, the Christmas / New Years holidays got in the way.

I'm attempting to duplicate this issue on my test server now.

-- hugh
 
Thank you for your time and help, I saw that you were very busy in the last weeks and for me it was not very urgent, I?m still learning the basics of Fabrik? :)

And congratulations for your support service, you do a great job here!
 
OK, I don't get that error you showed a code fix for, but that might just be because it got fixed in github since you posted that.

I can replicate the funky behavior with using Clear Filters, with AJAX and under heading filters. I'm still working on identifying the root of the problem.

I'll have to raise a github issue on this and assign it to Rob, as it doesn't look like something I'll be able to track and fix quickly.

-- hugh
 
Ok, thanks!

I don?t know if that helps but I notice that in the list. js, line 702
Code:
 var data = this.form.toQueryString();
var "data" has the correct filters applied before reset and no filters applied after that....
 
Hello,


I think I found a possible fix for this, by replacing this code (listfilter.js , lines 45 -50)

Code:
this.container.getElements('.fabrik_filter').each(function (f) {
     if (f.get('tag') === 'select') {
          f.selectedIndex = 0;
     } else {
	  f.value = '';
     }

With this one:
Code:
this.container.getElements('.fabrik_filter').each(function (f) {
		if (f.get('tag') === 'select') {
		    f.selectedIndex = 0;
		} else if (f.type === 'text') {
			     f.value = '';
		}

The problem is that when the filters are reset," f.value" takes many values in "each" loop:

- The value of filtered text -> type = 'text'
- And the value of conditions applied in the query ("AND", "CONTAINS", etc.?) -> type = 'hidden'

When "else" statement is executed (for non dropdown filters), all the above values are reset to " ' ' " and they are not reinitialized at the next filtration.

So, I think we should reset just " type='text' " values ??that are exactly the values ??used in filters.


Regards
 
Woops, it?s not a complete solution!

  • Search all it's 'type: search'
  • Dropdown filter it's 'type: select'
  • Field filter it's 'type: text?
  • Range filter it's 'type: search-one'
  • But autocomplete it's 'type: hidden'

So using:

Code:
        if (f.type !== 'hidden' ) {
		f.value = '';
	}

Works for all element filters except autocomplete.

I'm close, but not there...:(
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top