Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Filter on multiple columns? #192

Closed
carlygeehr opened this issue May 16, 2013 · 14 comments
Closed

Filter on multiple columns? #192

carlygeehr opened this issue May 16, 2013 · 14 comments
Labels

Comments

@carlygeehr
Copy link

Maybe this functionality is baked in already and I'm just not seeing it. Is there a way to filter on multiple columns at once? I'm going to have a number of columns, each of which has its own filter, limited in scope to that one column.

I'm not sure how to preserve/manipulate the query string so that filtering by a second column doesn't override the first filter.

Thanks!

@wyuenho
Copy link
Contributor

wyuenho commented May 17, 2013

Not yet. See #143.

@wyuenho wyuenho closed this as completed May 17, 2013
@carlygeehr
Copy link
Author

@wyuenho Oh ok - I think this is a different issue, though - sorting vs filtering?

@wyuenho wyuenho reopened this May 17, 2013
@wyuenho
Copy link
Contributor

wyuenho commented May 17, 2013

Whoops, speed reading didn't work this time :P

Which filter implementation are you using?

@carlygeehr
Copy link
Author

Haha no worries! Client side filter, in backgrid-filter.

@wyuenho
Copy link
Contributor

wyuenho commented May 17, 2013

https://github.com/wyuenho/backgrid/blob/master/src/extensions/filter/backgrid-filter.js#L130

The JSDuck doc for this class seems to be borked, will fix that tmr when I wake up. For now, hopefully the JSDoc can give you enough help.

@carlygeehr
Copy link
Author

Thanks. I've been man-handling the code trying to get it to do my bidding (essentially re-writing the search and makeMatcher functions) - and am grateful that your code is so clean that I can actually understand it enough to do it :) I think I'm pretty close to getting it to work. It's an ugly solution for now, but you gotta start somewhere, right?

@wyuenho
Copy link
Contributor

wyuenho commented May 17, 2013

It's designed specifically for you to man-handle and specialize. I can't possibly solved every problem there is, so I settled for building a foundation instead. Let me know if you have more problems. Wil fix #184 soon.

@echeypaz
Copy link

HI, I'm interesting in the same functionality, i would like that the filters AND functionality, the shadowcollection load collection previosly filtering, and then filter this filter collection with other filter.

Could you tell me do it?

@echeypaz
Copy link

Well, i believed that, modifing search function with {reindex: true}, it will update the shadowscollection, and then concat with AND the filters, it's works, but when i clear or modify the value to a filter the shadowcollection have to last collection. with this filter and not reset this filter.

@wyuenho
Copy link
Contributor

wyuenho commented Jul 20, 2013

This problem had been fixed. The filters have been moved to https://github.com/wyuenho/backgrid-filter. You can check out the master and play around with it. Come back if you have any more questions.

@echeypaz
Copy link

well the problem is that i had to modifying, i develop a select2 type filter as var ClientSideSelectFilter = Backgrid.Extension.ClientSideSelectFilter = ServerSideFilter.extend({
where i have a template

\template: _.template('div class="select-prepend select-append">select multiple class="select-combo" style="width:200px;" <% if (placeholder) { %> placeholder="<%- placeholder %>" <% } %> name="<%- name %>" ><% jQuery.each(elements, function (i,element) {%> <option value="<%= element.get("value") %>"><%= element.get(name) %> <% }) %>×'),

and modified search function etc.

and if update override my code

@echeypaz
Copy link

Well, i have update to the new individually filter, that you recomended me.
I have going to ClientSideFilter.js Class and i have change search function
this.collection.reset(this.shadowCollection.filter(matcher), {reindex: false});
by
this.collection.reset(this.shadowCollection.filter(matcher), {reindex: true});

And i have to the same problem:

  1. I filter by first filter. it's works
  2. then i filter by second filter. it's works. They do AND concatenation perfectly.
  3. Change or clear value from first filter and not recover the previous collection. i would like apply all filters newly not to the last collection.

Thanks.

@wyuenho
Copy link
Contributor

wyuenho commented Jul 20, 2013

I'm not sure what you are asking here, but it's clearly different from what this issue is about. If progressive filtering is what you are looking for, there's no plan to support it in Backgrid. This is something you have to do by yourself. There's no one filter that can satisfy everybody.

@echeypaz
Copy link

i thinked that the normal behaivour, when you clear filter and there are another filter with value should apply the filters with value over all collection.

thanks very much, i'll modify the search function.

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

No branches or pull requests

3 participants