jquery-stickytable

WebJar for jquery-stickytable

License

License

MIT
Categories

Categories

Github Development Tools Version Controls
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

github-com-jpchip-stickytable
Last Version

Last Version

3.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

jquery-stickytable
WebJar for jquery-stickytable
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jpchip/stickytable

Download github-com-jpchip-stickytable

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/github-com-jpchip-stickytable/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>github-com-jpchip-stickytable</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-jpchip-stickytable/
implementation 'org.webjars.npm:github-com-jpchip-stickytable:3.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/github-com-jpchip-stickytable/
implementation ("org.webjars.npm:github-com-jpchip-stickytable:3.0.0")
'org.webjars.npm:github-com-jpchip-stickytable:jar:3.0.0'
<dependency org="org.webjars.npm" name="github-com-jpchip-stickytable" rev="3.0.0">
  <artifact name="github-com-jpchip-stickytable" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='github-com-jpchip-stickytable', version='3.0.0')
)
libraryDependencies += "org.webjars.npm" % "github-com-jpchip-stickytable" % "3.0.0"
[org.webjars.npm/github-com-jpchip-stickytable "3.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

jQuery Sticky Table Headers

Make your table headers sticky

This is a version of the sticky table code originally written by Terry Munn, wrapped in a jquery plugin to make it more reusable. I also added some new options and functions.

Installing / Getting started

Install via NPM:

npm install --save jquery-stickytable 

Include jQuery(>=1.12.4) and jquery-stickytable in your head:

<script src="path/to/jquery.js"></script>
<script src="path/to/jquery-stickytable.min.js"></script>

and the css:

<link rel="stylesheet" type="text/css" href="path/to/jquery-stickytable.css">

Files can be found in dist folder:

dist/
├── jquery-stickytable.css
├── jquery-stickytable.js        (UMD)
├── jquery-stickytable.min.js    (UMD, compressed)
└── jquery-stickytable.esm.js    (ES Module, includes css)

Usage

Load stickyTable on your table:

$('#myTable').stickyTable(options);

By default just the header of the table (eg. the thead) is sticky. Biaxial headers are possible — this is for situations where both horizontal and vertical headers are needed. To enable, just wrap the first element in each tbody row in a th instead of a td:

  <tbody>
    <tr>
      <th>Sticky column</th>
      <td>value A</td>
      <td>value B</td>
      ...
    </tr>
    ...
  </tbody>

Options

Option Description
copyTableClass When true copies any classes on the target table to the sticky table. Default is true.
copyEvents When true copies any events on the target table to the sticky table. An example would be if there was a click event on a th element in the thead to do sorting, this would carry over to the sticky column header th. Default is false.
overflowy When true adds an overflow-y class to the sticky table wrapper (ie. sticky-wrap class). This means the table will scroll vertically and only be as tall as it's parent div (see .sticky-wrap.overflow-y in css). Default is false.

Methods

Methods cannot be called until the stickyTable plugin has been initialized on the element.

destroy

Completely removes sticky table classes and elements and destroys the instance.

  $('#myTable').stickyTable('destroy');

Styles

The sticky headers have default colors set, but you can override this css:

.sticky-wrap .sticky-intersect th {
    background-color: #666;
    color: #eee;
}

.sticky-wrap th {
	background-color: #666;
	color: #eee;
}

Exceptions

  • If target element is not a table.
  • If plugin has not been initialised when calling a method
  • If method is private
  • If method does not exist

Source

Versions

Version
3.0.0