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

super-table

v1.0.2

Published

jQuery plugin that allows HTML table headers to intuitively scroll with the browser window. Optionally simplify complex tables by expanding/collapsing groups of rows or columns.

Downloads

25

Readme

SuperTable

Make HTML tables Super

The SuperTable jQuery plugin makes the header and left row of an HTML table intuitively scroll with the browser window. You can also setup your table to have collapsible rows and columns.

Scrolling

Setting up your <thead> ... </thead> table header and the left-most column of your table to scroll with the the browser is easy!

$(yourTable).superTable();

Want the table header to scroll but not the left-most column?

$(yourTable).superTable({
    scrollColumn : false
});

Demos

To see a demonstration, checkout the basic demo of the above commands or a complete demo which includes all of SuperTable's features.

Collapsing Columns and Headers

Large HTML tables can be very cumbersome in a web browser. That's why most reports get exported directly to CSV. But that doesn't provide a good user experience if the user needs to check an updated report frequently. This is where collapsible rows and columns come into play. They allow a complex table to be quickly reduced to only the most important information while still preserving all the fine-grained details.

When you configure your table to support collapsing headers, clicking a <th> element will collapse your table's columns. Similarly, when your table is configured to support collapsing rows, clicking a <td> element that's the first <td> element of a row will collapse your table's rows. If you need to group rows and columns into groups that collapse and expand together, you can do that too!

Notes on how to setup collapsible rows

  • <tr> rows that have the rowHideable class are collapsible.
  • <tr> rows that share the same value for their optional data-ST-group attribute are considered to be a group of rows that will collapse and expand together.
  • <tr> rows that have the data-ST-group but not the rowHideable class will not themselves collapse, but will collapse other rowHideable rows in the group when the row's first td/tr cell is clicked on
  • <tr> rows that have neither the data-ST-group nor the rowHideable class will not themselves collapse, but will collapse all other rowHideable rows when the row's first td/tr cell is clicked on

Notes on how to setup collapsible columns

  • <th> and <td> cells that have the columnHideable class are collapsible.
  • Use the col-span-min and col-span-max attributes when using collapsible columns with a table that has cells that use the col-span attribute.
  • col-span-min defines how many columns a cell should span when all columns, or the group of columns that the cell belongs to, are collapsed
  • col-span-max defines how many columns a cell should span when all columns, or the group of columns that the cell belongs to, are expanded
  • Table <th> and <td> cells that share the same value for their optional data-ST-group attribute are considered to be a group of rows that will collapse and expand together.
  • Table <th> cells that aren't part of a group, will expand/collapse all columnHideable cells when clicked

Expanding/Collapsing the entire table at once

It is sometimes handy to expand or collapse the entire table at once. If both row and column collapsing are enabled, a th cell that is also the first cell of a row will trigger both row and columns to expand/collapse at once.

You can designate another HTML element on the page to trigger a table's expand/collapse all event by setting that element's optional data-super-table attribute to the id attribute of the table in question.

Try it out yourself

Check out the example/index.html file to see a nearly comprehensive example of table scrolling and collapsible rows and columns in action. Click on the <th> cells or a row's first <td>/<th> cell to collapse a group of columns or rows respectively.

Settings

How to configure settings

Default settings can be set before initializing a SuperTable.

    $.fn.superTable.defaults.columnCollapse = true;
    $.fn.superTable.defaults.columnCollapsedClass = 'collapsedColumn';
    

Otherwise, settings can be configured when initializing a SuperTable by passing your preferred options via an object passed as the first parameter of the superTable() function

    $('#demoTable1').superTable({
        rowCollapse = true,
        rowCollapsedClass : 'collapsedColumn',
        rowExpandedClass : 'expandedColumn'
    });

The only setting that has an effect after a SuperTable has been initialized is the "remove" setting.

    $('#demoTable1').superTable({
        remove = true
    });

List of all settings

  • scrollHead - Bool (default = true) When false, table header scrolling functionality is disabled

  • scrollColumn - Bool (default = true) When false, table column scrolling functionality is disabled

  • rowCollapse - Bool (default = false) When true, collapsing row functionality is enabled

  • rowCollapsedClass - String (default = '') If provided, this class will get added to all collapsed elements

  • rowExpandedClass - String (default = '') If provided, this class will get added to all Expanded elements

  • columnCollapsedClass - String (default = '') If provided, this class will get added to all collapsed and elements

  • columnExpandedClass - String (default = '') If provided, this class will get added to all Expanded and elements

  • startCollapsed - Bool (default = false) If true, the table will start collapsed

  • remove - Bool (default = false) If true, all SuperTable functionality will be removed from the specified HTML table(s)