guggenheim.js icon indicating copy to clipboard operation
guggenheim.js copied to clipboard

Example of filters using class and classes

Open macsupport opened this issue 11 years ago • 4 comments

Any chance of a demo showing filtering by class and/or classes in addition to your filter function demo?

Mike

macsupport avatar Mar 20 '13 20:03 macsupport

Hey, unless I'm misunderstanding what you want, the filter function on the examples page is actually filtering by classes. All the function is doing is collating which classes we want to filter by from the inputs and passing them to guggenheim, which then filters by them.

OiNutter avatar Mar 21 '13 13:03 OiNutter

Sorry I was not clear. I was a bit confused about how to set up the filtering in a way other than using checkboxes or radio buttons. I figured out how to use jQuery select2 and classes to filter items.

macsupport avatar Mar 21 '13 14:03 macsupport

Is there an way to set up a filterFunction to use a input field to search for text used in a guggenheim-item to filter rather than using classes or checkboxes, etc. ?

macsupport avatar Jul 30 '14 17:07 macsupport

You should be able to pass your own function to filter which will have each element passed to it in turn and use that to inspect the element. Bear in mind it will be the basic DOM element that gets passed so if you're using jQuery or something similar you'll need to convert the element to use jQuery methods on it.

As for hooking into the input field you should just be able to hook into the change event and have your event handler call the filter function and have your filter function grab the value from the input.

If you're still having problems let me know. I haven't actually tested that this will work, it's entirely based of theory and what the code's supposed to do :)

OiNutter avatar Jul 31 '14 07:07 OiNutter