Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent it from triggering when moving away from input fields #84

Open
shufeilei opened this issue Feb 22, 2016 · 2 comments
Open

Prevent it from triggering when moving away from input fields #84

shufeilei opened this issue Feb 22, 2016 · 2 comments

Comments

@shufeilei
Copy link

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 shufeilei changed the title Stop it from triggering when moving away from input fields Prevent it from triggering when moving away from input fields Feb 22, 2016
@shufeilei
Copy link
Author

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!

@kingdonb
Copy link

kingdonb commented Aug 4, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants