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

Add filterFor function #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

paulashfield
Copy link

Hi,

I've added a function .filterFor(filterText) - this can be called by other controls to allow filtering of the list be e.g. a select dropdown box.

Hope this is useful to others.

@james-peel
Copy link

@paulashfield Do you have a full example for a select using your filterFor method, please?

@paulashfield
Copy link
Author

@james-peel sure - Given this HTML:

<ul id="shapes">
  <li>Green Circle</li>
  <li>Red Circle</li>
  <li>Green Square</li>
  <li>Yellow Square</li>
</ul>
<input type="text" id="filter"/> 
<input type="button" id="circles" value="circles"/>

...this script will filter the list for Circles in the button onclick:

var fLF = $('#filter').fastLiveFilter('#shapes', {});

$('#circles').click(function () {
  // Only show the circles
  fLF.filterFor('Circle');
});

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

Successfully merging this pull request may close these issues.

2 participants