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

inset_tables

v1.0.0

Published

A jQuery DataTables plugin that allows you to generate a DataTable as an inset table with a minimap. It is functionally similar to the official DataTables FixedColumns extension.

Downloads

2

Readme

Fixed Columns for DataTables

inset_tables is a npm module that replicates much of the functionality found within the jQuery DataTables FixedColumns Extension available at datatables.net.

On initialization, inset_tables will create another <table> element ( referred to as the overlay/inset table ) that positions itself over the base table. Additionally, a minimap is created that allows you to scroll through hidden columns. The overlay/inset table will respond to DataTable events such as search.dt, order.dt, length.dt, page.dt, click.dt, etc. It also plays nicely with the Select Extension from datatables.net.

Getting Started

  1. Download inset_tables from npm.
npm install inset_tables
  1. Pass your jQuery instance into the inset_tables constructor, which will return jQuery with the new inset_tables plugin available on the DataTables API.
import jQuery from "jquery";
import insetTables from "inset_tables";

var $ = jQuery;

$ = insetTables( $ );
  1. Initialize your DataTable, making sure to pass in the option scrollX: true, and call the inset_tables function using the API of your newly-initialized DataTable.
var testTable = $( "#tester-table" ).dataTable( {
    "scrollX": true,
    "inset": 3,
    "autoWidth": true,
    "data": data,
    "columns": columns
} );

testTable.api().createInsetTable();

Please note

  1. You must pass in scrollX: true for this plugin to work.
  2. You must initialize your DataTable with data and columns options, instead of hardcoding table cells and columns. This is because in order to generate the overlay/inset table the base table data and columns must be available through table.api().init(), which is not possible with hardcoded data.
  3. By default, inset_tables will fix two( 2 ) columns. You can modify this by passing an inset option to the .dataTable() constructor. The inset option must be greater than zero( 0 ).
  4. Pass in the autoWidth: true option if you would like the overlay/inset table and minimap to be resize responsively when the browser width changes. autoWidth: true allows the column-sizing.dt to fire on resize, which this API listens for. In some cases autoWidth: true leads to the base table rendering strangely. If this is the case, manually hard code the table width: <table width="100%"/>.