Skip to content

Add filterFor function - #25

Open
paulashfield wants to merge 2 commits into
awbush:masterfrom
paulashfield:master
Open

Add filterFor function #25
paulashfield wants to merge 2 commits into
awbush:masterfrom
paulashfield:master

Conversation

@paulashfield

Copy link
Copy Markdown

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
Copy Markdown

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

@paulashfield

Copy link
Copy Markdown
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