Using plugins

Getting started

To use a plugin you need two things:

  1. Include the plugins .js-file at the page.
  2. Include it when you instantiate List.js

    new List('list-id', {
      plugins: [ ListPagination(), NameOfOtherPlugin(options) ]
    });

Naming and accessing plugins

It is also possible to add options and load multiple instances of the same plugins (if the plugin itself allows it).

If the property name is added in the plugin option parameter does the plugin become accessible through listObj.namePropertyValue.This is useful when having multiple instances of the same plugin.

var myList = new List('list-id', {
  plugins: [
    ListPagination({ name: "topPagination", paginationClass: "top-pagination" }),
    ListPagination({ name: "bottomPagination", paginationClass: "bottom-pagination" })
  ]
});
console.log(myList.topPagination);
console.log(myList.bottomPagination);

Build your own plugin

Go to: /docs/plugins/build