LiveFilter

Super simple list filtering.

View the Project on GitHub mikemerritt/LiveFilter

License Information

LiveFilter jQuery Plugin

https://github.com/mikemerritt/LiveFilter

COPYRIGHT (c) 2010-2012 Mike Merritt

http://www.mikemerritt.me

The terms of this software are described in the file LICENSE, which you should have received as part of this distribution. Redistributions of files must retain the above copyright notice.

Description

LiveFilter is a jQuery plugin that can be used to sort lists of data in realtime, as you type.

Live Demo

This demo will filter a portion of the IMDB top 200 list.

  • The Shawshank Redemption (1994)
  • The Godfather (1972)
  • The Godfather: Part II (1974)
  • Il buono, il brutto, il cattivo. (1966)
  • Pulp Fiction (1994)
  • The Dark Knight (2008)
  • Schindler's List (1993)
  • One Flew Over the Cuckoo's Nest (1975)
  • 12 Angry Men (1957)
  • The Empire Strikes Back (1980)
  • Casablanca (1942)
  • Star Wars (1977)
  • Shichinin no samurai (1954)
  • LotR: The Return of the King (2003)
  • Goodfellas (1990)
  • Rear Window (1954)
  • Cidade de Deus (2002)
  • Raiders of the Lost Ark (1981)
  • C'era una volta il West (1968)
  • LotR: The Fellowship of the Ring (2001)
  • Fight Club (1999
  • The Usual Suspects (1995)
  • Psycho (1960)
  • The Silence of the Lambs (1991)
  • Sunset Blvd.(1950)
  • Dr. Strangelove (1964)
  • The Matrix (1999)
  • Momento (2000)
  • North by Northwest (1959)
  • It's a Wonderful Life (1946)
  • Citizen Kane (1941)
  • Se7en (1995)
  • LotR: The Two Towers (2002)
  • Léon (1994)
  • Apocalypse Now (1979)
  • American Beauty (1999)
  • Taxi Driver (1976)
  • American History X (1998)
  • Lawrence of Arabia (1962)
  • Vertigo (1958)
  • WALL·E (2008)
  • Forrest Gump (1994)
  • Paths of Glory (1957)
  • Le fabuleux destin d'Amélie Poulain (2001)
  • M (1931)
  • Double Indemnity (1944)
  • To Kill a Mockingbird (1962)
  • Alien (1979)
  • A Clockwork Orange (1971)
  • The Treasure of the Sierra Madre (1948)

How to Use

LiveFilter expects your list to use a certain HTML structure. It can be used on ordered/unordered lists and tables. Your list must reside inside of a div that the plugin will be targeting. An example of the structure is below.

<div id="wrapping_div">
    <input class="filter" type="text" value="" />
    <input class="reset" type="reset" value="Reset!" />
    <ul>
        <li>List Item</li>
        <li>List Item</li>
        <li>List Item</li>
        <li>List Item</li>
        <li>List Item</li>
        <li>List Item</li>
    </ul>
</div>

If your list follows the proper structure like above, you can then call the liveFilter() function on the wrapping div like so.

<script type="text/javascript">
    $('#wrapping_div').liveFilter();
</script>

If you need custom settings you can set them like this.

<script type="text/javascript">
    $('#wrapping_div').liveFilter({
        delay: 300, 
        defaultText: 'Custom Default Text:',
        zebra: {
            enabled: true,
            baseColor: '#13345d',
            altColor: '#174175'
        }
    });
</script>

The full list of available properties, their defaults and what they expect are listed below.

Changelog