← Back to javve/list.js

How to Deploy & Use javve/list.js

List.js Deployment and Usage Guide

Prerequisites

  • Runtime: Modern web browser (Chrome, Safari, Firefox, IE9+)
  • Tools: None required for basic usage
  • Package Managers: Optional - npm, bower, or direct download
  • Dependencies: None (List.js is a standalone library)

Installation

Via NPM

npm install list.js

Via Bower

bower install list.js

Via CDN

Add this script tag to your HTML:

<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/2.3.1/list.min.js"></script>

Via Direct Download

Configuration

List.js works with existing HTML and requires minimal configuration:

  1. HTML Structure: Prepare your list or table with appropriate classes
  2. JavaScript Initialization: Create a new List instance
<div id="my-list">
  <div class="list">
    <div class="item">
      <div class="name">Jonny</div>
      <div class="born">1986</div>
    </div>
    <div class="item">
      <div class="name">Jonas</div>
      <div class="born">1985</div>
    </div>
  </div>
</div>

<script>
  var options = {
    valueNames: ['name', 'born']
  };
  var userList = new List('my-list', options);
</script>

Available Options

  • valueNames: Array of class names to track
  • listClass: Class name for the list container (default: 'list')
  • searchClass: Class name for search input (default: 'search')
  • sortClass: Class name for sort buttons (default: 'sort')
  • page: Number of items per page for pagination (default: 10000)
  • fuzzySearch: Configuration for fuzzy search functionality

Build & Run

Development

  1. Include List.js in your HTML file
  2. Initialize List.js with your configuration
  3. Add search, sort, and filter functionality to your HTML elements

Production

  1. Use the minified version for production: list.min.js
  2. Consider bundling with your build tool (Webpack, Gulp, etc.)
  3. Optimize loading by placing script tags at the end of the body

Deployment

List.js is a client-side JavaScript library, so deployment is straightforward:

Static Hosting (Recommended)

  • Vercel (formerly Zeit Now)
  • Netlify
  • GitHub Pages
  • Surge.sh

Traditional Hosting

  • AWS S3 + CloudFront
  • Firebase Hosting
  • DigitalOcean Spaces

Framework Integration

  • Next.js: Import and use in components
  • Gatsby: Include in gatsby-browser.js
  • Create React App: Add to public folder or import via npm

Troubleshooting

Common Issues

Issue: List.js not working with existing HTML Solution: Ensure your HTML structure matches the expected format with proper class names.

Issue: Search functionality not working Solution: Verify that valueNames in your configuration matches the class names in your HTML.

Issue: Sorting not working Solution: Add the sortClass to your sort buttons and ensure the data-sort attribute matches the value name.

Issue: No items showing after filtering Solution: Check your filter function logic and ensure items have the correct classes.

Issue: Performance issues with large datasets Solution: Use pagination (page option) or consider server-side filtering for very large datasets.

Debugging Tips

  1. Check browser console for JavaScript errors
  2. Verify List.js is loaded before your initialization script
  3. Use the uncompressed version (list.js) for debugging
  4. Test with a minimal HTML structure first

Getting Help

Performance Optimization

  1. Use pagination for large lists
  2. Debounce search input (List.js has built-in search delay)
  3. Use the minified version in production
  4. Consider lazy loading for very large datasets

Browser Compatibility

List.js supports:

  • Chrome
  • Safari
  • Firefox
  • IE9+

For older browsers, consider using polyfills for Array methods if needed.