filterrific icon indicating copy to clipboard operation
filterrific copied to clipboard

Prevent it from triggering when moving away from input fields

Open shufeilei opened this issue 9 years ago • 2 comments

Updated to be more specific:

I'm using Filteriffic on on a table to filter displayed results. I've added a new column in the display containing checkboxes for each row. The idea is, a user can make multiple selections using the checkboxes and then perform an action with all the selected rows.

The problem i'm having is that after a user has entered a filtering term in the input, they would naturally select the filtered results. However, clicking on any of the rows causes the onchange event to fire, which then resets the checkboxes. This only happens the first time the user interacts with other elements.

So the question is, how can I isolate the row-specific checkboxes? Or, how can I prevent "onblur" from triggering the filterrific update?

Hopefully this is more clear.

Original: Filterrific works well for a part of my application, which displays a table of names. Recently, I added some checkboxes next to the names so that I can do a bulk selection and manipulation. However, when I move away from the search/query fields in the filterrific form to click on the checkboxes next to the names, the results table gets refreshed and the selections are erased. Although this would only happen once, it would be pretty bothersome for my users. Do you have any suggestions on dealing with this issue? Thanks.

shufeilei avatar Feb 22 '16 20:02 shufeilei

I resolved my own issue by overwriting the Filterrific initialization with the following:

$('#filterrific_filter').on( "change", ":input", function (e) { e.stopImmediatePropagation(); $(this).off("blur"); Filterrific.submitFilterForm; } );

I stop the BLUR event from trigger in the CHANGE event. Reference: http://stackoverflow.com/questions/13509484/can-i-prevent-blur-event-from-happening

However, if you have any better suggestions or ways to handle this, please provide your feedback and comments. Thanks!

shufeilei avatar Feb 23 '16 18:02 shufeilei

Thank you, I reported #139 and it looks like your suggestion will be exactly what I needed!

kingdonb avatar Aug 04 '17 18:08 kingdonb