npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

inferno-datatable

v0.1.0

Published

InfernoJS datatables without jQuery. Smart Inferno datatable that includes search, pagination and localization.

Downloads

3

Readme

inferno-datatable

A InfernoJS datatables without jQuery. Smart datatable that includes search, pagination, and localization support.

DEMO: InfernoJS Datatables in Action!

Jump to: installing, required props, costumization (e.g. localization) via config, styling, roadmap, contributing.

Fun fact, this a re-write of my React-based datatables library.

Install

To get started with inferno-datatable in your project:

npm i inferno-datatable --save
# or
yarn add inferno-datatable --save

Then:


import InfernoDatatable from 'inferno-datatable';

// somewhere:

<InfernoDatatable
  tableKey={key}
  columns={columns}
  rows={rows}
  config={config} // optional, overrides all default settings/labels
/>

Now you are all set to enjoy some InfernoJS datatables in your project! 🙌

Look at the demo data file for examples of how the rows and columns props look.

You can also clone this repo which includes a full demo with create-inferno-app that you can use to try out the library.

Required Prop Docs

The tableKey is a String used to identify the table dataset. It is required.

The columns prop is an array of colum objects which have a key and label. Like this:

const columns = [{
    key: 'id',
    label: '#',
  }, {
    key: 'name',
    label: 'Name',
  }, {
    key: 'email',
    label: 'Email',
  },
];

The rows prop is an array of objects that have the key-value pairs described in our columns. For example:


const rows = [
  {
    id: 1,
    name:  'Sansa Stark',
    email: '[email protected]',
    onClickHandler: someFunction,
    isActive: true,
  },
  {
    id: 2,
    name: 'Jon Snow',
    email: '[email protected]',
    onClickHandler: someFunction,
    isActive: false,
  },
];

The key onClickHandler is optional. It will attach an onClick() callback on the row. The isActive prop is also optional. The row that has this prop set to true will have a special class applied (CSS styling purposes).

Config prop

You can pass a config prop the <InfernoDatatable /> component to change all the default settings and labels.

This is great if you want to change the text or localize your component. Here’s an overview of all the options you can specify via the config object:

  • itemsPerPageOptions: an Array of Numbers, defaults to [10, 25, 50, 100],
  • itemsPerPageLabel: a String, defaults to Entries per page:
  • nextPageLabel: a String, defaults to Next
  • previousPageLabel: a String, defaults to Back
  • searchLabel: a String, defaults to Search:
  • searchPlaceholder: a String, default to Type to search…
  • noEntriesLabel: a String, defaults to No entries to show.
  • entryCountLabels: an Array of Strings, defaults to ['Showing', 'to', 'of', 'entries.']. Prints out Showing 10 to 20 of 300 entires. at the bottom of the table.

See the customOptions object in the demo data for an example of how it is used in example #2 on the demo page.

Styling

Out of the box, inferno-datatable is somewhat bare-bones. Include this CSS starter file in your project to get the look from the demo. Edit it to suit your needs.

The distribution of library (see lib directory) comes with a cool .css file that has the markup from above.

Roadmap

  • More control over pagination and search (and a better performing search!)
  • Unit and performance tests.
  • Sortable columns.
  • CSV/PDF/Excel download
  • ~~Localization support~~ (available since v0.1.15)

Contribute

There are many ways to contribute. For example:

  • Test the library in your project, open an issue if you find bugs or problems!
  • If you are enjoying the library, star it here on Github to show your support.
  • Have a feature request? Want the roadmap to hurry up? Open a feature request via the issues tab.
  • Fixed a problem or added a feature on your fork? Send a PR to make it part of the main distribution.
  • The docs could be better? Found a typo? Submit a PR!

Need help with your first PR in OSS? Open an issue and we will find something simple and cool for you!