0.1.4 • Published 4 years ago

@mp3000mp/list-filter v0.1.4

Weekly downloads
6
License
Apache 2.0
Repository
github
Last release
4 years ago

list-filter

Simple library with no dependencies that help you to hide html list items or table rows that do not match a pattern

Build Status Coverage Status npm version License

Table of Contents

Demo

Try it on JSFiddle

Installation

npm install --save @mp3000mp/list-filter

Usage

// This will create window.ListFilter
const ListFilter = require('list-filter')

Example

You have to create a new instance for binding a list to an input trigger

// on document ready
document.addEventListener('DOMContentLoaded', function(){
    let trigger = document.getelementById('my-trigger');
    let list = document.getelementById('my-list'); // works with table or ul element
    let options = {};

    let oListFilter = new ListFilter(trigger, list, options);
});

Configuration

Here are the key you can use to configure your instance

KeyTypeDefaultDescription
caseSensitivebooleanfalseCase sensitive search or not.
keyupDelayNumber50Time in millisecond before refreshing the DOM.
searchInAttributeboolean or stringfalseData attribute used for comparison, innerHTML if false.
onSearchCallbacknullFunction to run after each comparison, return true to display the element, false to hide it.
onAfterSearchCallbacknullFunction to run after DOM refresh.
0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

5 years ago