Skip to content

Plugin for Mobius1/Selectable that enables fast column / row selection.

Notifications You must be signed in to change notification settings

Mobius1/Selectable-Table-Plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Selectable Table Plugin

npm npm version license Average time to resolve an issue Percentage of issues still open

Plugin for Mobius1/Selectable that enables fast column and / or row selection / deselection.


Install

Bower

bower install selectable-table-plugin --save

NPM

npm install selectable-table-plugin --save

CDN

https://unpkg.com/selectable-table-plugin@latest/selectable.table.min.js

Enable Plugin

Add the [data-selectable="column"] attribute to the required th cells you want to enable

Add the [data-selectable="row"] attribute to the required column cells to enable row selection

Add the [data-selectable="all"] to a cell to enable selection / deselection of all cells.

<table>
  <thead>
    <tr>
      <th data-selectable="all"></th> <!-- select all -->
      <th data-selectable="column">Heading 1 Title</th> <!-- select column -->
      <th data-selectable="column">Heading 2 Title</th> <!-- select column -->
      <th data-selectable="column">Heading 3 Title</th> <!-- select column -->
      <th data-selectable="column">Heading 4 Title</th> <!-- select column -->
    </tr>
  </thead>
  <tbody>
    <tr>
      <td data-selectable="row">Row Title</td> <!-- select row -->
      <td>Cell 1</td>
      <td>Cell 2</td>
      <td>Cell 3</td>
      <td>Cell 4</td>
    </tr>
    ...
  </tbody>
</table>

Make sure the plugin is included AFTER Selectable:

<script src="path/to/selectable.min.js"></script>
<script src="path/to/selectable.table.min.js"></script>

then:

// instantiate Selectable
const selectable = new Selectable();

// enable the table plugin
selectable.table();

That's it!


Copyright © 2017 Karl Saunders | BSD & MIT license

About

Plugin for Mobius1/Selectable that enables fast column / row selection.

Resources

Stars

Watchers

Forks

Packages

No packages published