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

Allow users to add and remove filters (only one) #40

Closed
yochannah opened this issue Jun 18, 2018 · 7 comments
Closed

Allow users to add and remove filters (only one) #40

yochannah opened this issue Jun 18, 2018 · 7 comments

Comments

@yochannah
Copy link
Collaborator

"clear filters" is great, but sometimes a user might want to remove just one of the filters and leave the others intact. Could we have an x beside any active filter?

@yochannah yochannah added this to the Milestone 2 (July 9) milestone Jun 18, 2018
@yochannah
Copy link
Collaborator Author

There is a removeConstraint method in im-tables, but I think it expects to be passed a ActiveConstraint backbone object, which isn't ideal.

Would modifying im-tables to accept the code (e.g. "B") of a constraint to remove be a good way forward for you? I can look at this probably no earlier than mid-july, unfortunately, due to a conference/

@AdrianBZG
Copy link
Owner

AdrianBZG commented Jun 19, 2018

@yochannah The thing is I'm not sure how to give a code to a constraint using addConstraint, maybe it's useful to remove a constraint by index, like removeConstraint(1) -> removes second constraint. This way I can keep a index per constraint and attach it to the event of selecting one, so when the user removes it I can just delete the associated constraint... what do u think?

@yochannah
Copy link
Collaborator Author

it looks to me like the constraints get automatically appended to the end of the constraints array, but I think it's probably safer to explicitly use the codes. You can set the code when you add the constraint, e.g.

          table.query.addConstraint({
            "path": "goAnnotation.ontologyTerm.name",
            "op": "==",
            "value": "protein binding",
            "code" : "B"
          });

@AdrianBZG
Copy link
Owner

@yochannah ok! Perfect 👍

@yochannah
Copy link
Collaborator Author

ok, I was wrong - this is already possible! I'm learning so much about imjs and imtables this GSoC 😆

Demo to remove a constraint: https://yochannah.github.io/im-tables-examples/constraint-remove.html

@AdrianBZG
Copy link
Owner

AdrianBZG commented Jun 20, 2018

@yochannah Wonderful, that's exactly what I need 👍 thanks

@AdrianBZG
Copy link
Owner

@AdrianBZG AdrianBZG changed the title Allow users to remove just one filter Allow users to add and remove filters Aug 2, 2018
@AdrianBZG AdrianBZG changed the title Allow users to add and remove filters Allow users to add and remove filters (only one) Aug 2, 2018
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