Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Fixes #48 Fixes #258 Fixes #77
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Feb 9, 2017
1 parent f3b40e4 commit b341fe2
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 94 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ A set of plugins for responsive tables.
* [Mode Switcher](#mode-switcher)
* [Sortable](#sortable)
* [Kitchen Sink Example](http://filamentgroup.github.io/tablesaw/demo/kitchensink.html)
* [Limitations](#limitations)
* [Run Tests](http://filamentgroup.github.io/tablesaw/test/tablesaw.html)

## Stack Mode
Expand All @@ -35,6 +36,7 @@ If you only want to use the Stack Table and don’t want all the extra features
| Option | Description |
| --- | --- |
| Opt out of inline labels | To opt-out of inline label creation (the table header cell text that shows at small breakpoints) on a per-table basis, use `<table data-tablesaw-no-labels>`; on a per-row basis, use `<tr data-tablesaw-no-labels>`. |
| Hide headers for empty body cells | When the table cell is empty, use `<table data-tablesaw-hide-empty>` to hide the header when stacked. |

## Toggle Mode

Expand Down Expand Up @@ -315,6 +317,11 @@ Some of the more intrusive default styles have instead moved to opt-in classes y
* `tablesaw-row-zebra`: Adds a light background color to every other table row.
* `tablesaw-swipe-shadow`: Adds the light shadow to the right of persistant columns to make them stand out a little more.

## Limitations

* Simple `colspan` and `rowspan` are supported, in part thanks to a [lovely PR](https://github.com/filamentgroup/tablesaw/pull/225) from @jgibson. More complex `colspan` scenarios (where table cells cross Tablesaw top-level column boundaries) are not supported. Tablesaw top-level column boundaries are defined by the cells in the first table header row and determine what columns are listed in the Column Toggle switcher or what hides/shows when the user navigates on a Swipe table.
* `rowspan` is not yet supported on *Stack* or *Sortable* tables.

## [Tests](http://filamentgroup.github.io/tablesaw/test/tablesaw.html)

## Building the Project Locally
Expand Down
79 changes: 79 additions & 0 deletions demo/colspan-sm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TableSaw Column Toggle Table</title>

<link rel="stylesheet" href="../dist/tablesaw.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="//filamentgroup.github.io/demo-head/demohead.css">
<style>
th,
td {
border: 1px solid #000;
}
</style>
<script src="../dist/tablesaw.js"></script>
<script src="../dist/tablesaw-init.js"></script>
<script src="//filamentgroup.github.io/demo-head/loadfont.js"></script>
</head>
<body>
<div class="demo-header">
<div class="company">
<img src="http://filamentgroup.com/images/fg-logo-positive-sm-crop.png">
</div>
<div class="details">
<h1 class="description-container">Demo of <span class="repo-name">Tablesaw</span>
<span class="description">A group of plugins for responsive tables.</span>
</h1>
<ul class="outbound-links">
<li><a href="https://github.com/filamentgroup/tablesaw">Code</a></li>
<li><a href="https://github.com/filamentgroup/tablesaw/issues">Issues</a></li>
</ul>
</div>
</div>
<div class="nav-container">
<div class="docs-globalnav">
<nav class="docs-nav">
<a href="kitchensink.html" class="current">Kitchen Sink</a>
<a href="modeswitch.html">Mode Switch</a>
<a href="sort.html">Sortable</a>
<a href="stack.html">Stack</a>
<a href="stackonly.html">Stack Only</a>
<a href="swipe.html">Swipe Table</a>
<a href="toggle.html">Toggle</a>
</nav>
</div>
</div>
<div class="docs-main">
<h2>Colspans</h2>
<table class="tablesaw" data-tablesaw-mode="columntoggle" data-tablesaw-minimap data-tablesaw-mode-switch>
<thead>
<tr>
<th data-tablesaw-priority="1">Header 1</th>
<th data-tablesaw-priority="1">Header 2</th>
<th data-tablesaw-priority="1">Header 3</th>
</tr>
<tr>
<th data-tablesaw-priority="1">Header 1</th>
<th data-tablesaw-priority="1" colspan="2">Header 2 (colspan=2)</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td colspan="2">colspan="2"</td>
<td>3</td>
</tr>
</tbody>
</table>
</div>

</body>
</html>
8 changes: 7 additions & 1 deletion demo/colspan.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<link rel="stylesheet" href="../dist/tablesaw.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="//filamentgroup.github.io/demo-head/demohead.css">
<style>
th,
td {
border: 1px solid #000;
}
</style>

<script src="../dist/tablesaw.js"></script>
<script src="../dist/tablesaw-init.js"></script>
Expand Down Expand Up @@ -66,7 +72,7 @@ <h2>Colspans</h2>
<td>Col 4</td>
<td>Col 5</td>
</tr>
<tr><td>Body Row 2 Col 1</td><td>Col 1</td><td>Col 1.5</td><td colspan="2">Col 2 (span 2)</td><td>Col 3</td><td>Col 4</td><td>Col 5</td></tr>
<tr><td>Body Row 2 Col 1</td><td>Col 1</td><td>Col 1.5</td><td colspan="2">Col 2 (colspan=2)</td><td>Col 3</td><td>Col 4</td><td>Col 5</td></tr>
<tr><td>Body Row 10</td><td>10</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>
<tr><td>body row 4</td><td>10</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>
<tr><td>Body Row 1.2</td><td>1.2</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>
Expand Down
83 changes: 83 additions & 0 deletions demo/rowspan.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TableSaw Column Toggle Table</title>

<link rel="stylesheet" href="../dist/tablesaw.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="//filamentgroup.github.io/demo-head/demohead.css">

<script src="../dist/tablesaw.js"></script>
<script src="../dist/tablesaw-init.js"></script>
<script src="//filamentgroup.github.io/demo-head/loadfont.js"></script>
</head>
<body>
<div class="demo-header">
<div class="company">
<img src="http://filamentgroup.com/images/fg-logo-positive-sm-crop.png">
</div>
<div class="details">
<h1 class="description-container">Demo of <span class="repo-name">Tablesaw</span>
<span class="description">A group of plugins for responsive tables.</span>
</h1>
<ul class="outbound-links">
<li><a href="https://github.com/filamentgroup/tablesaw">Code</a></li>
<li><a href="https://github.com/filamentgroup/tablesaw/issues">Issues</a></li>
</ul>
</div>
</div>
<div class="nav-container">
<div class="docs-globalnav">
<nav class="docs-nav">
<a href="kitchensink.html">Kitchen Sink</a>
<a href="modeswitch.html">Mode Switch</a>
<a href="sort.html">Sortable</a>
<a href="stack.html">Stack</a>
<a href="stackonly.html">Stack Only</a>
<a href="swipe.html">Swipe Table</a>
<a href="toggle.html" class="current">Toggle</a>
</nav>
</div>
</div>
<div class="docs-main">

<h2>Column Toggle with Rowspan Table</h2>
<table class="tablesaw" data-tablesaw-mode="swipe">
<thead>
<tr>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Movie Title</th>
<th scope="col" rowspan="2" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3" style="border: 1px solid #000">rowspan=2</th>
<th scope="col" colspan="2" data-tablesaw-sortable-col data-tablesaw-priority="2" style="border: 1px solid #000">colspan=2</th>
</tr>
<tr>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Movie Title</th>
<th scope="col" colspan="2" data-tablesaw-sortable-col data-tablesaw-priority="2" style="border: 1px solid #000">colspan=2</th>
</tr>
</thead>
<tbody>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Avatar_(2009_film)">Avatar</a></td>
<td>1</td>
<td>2009</td>
<td rowspan="2" style="border: 1px solid #000">rowspan=2</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Titanic_(1997_film)">Titanic</a></td>
<td>2</td>
<td>2009</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/The_Avengers_(2012_film)">The Avengers</a></td>
<td>3</td>
<td>2012</td>
<td>2012</td>
</tr>
</tbody>
</table>
</div>

</body>
</html>
3 changes: 1 addition & 2 deletions demo/sort.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ <h3 class="docs">Default appearance (with optional sortable-switch)</h3>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/The_Avengers_(2012_film)">The Avengers</a></td>
<td>3</td>
<td>2012</td>
<td>92%</td>
<td colspan="2">2012</td>
<td>$1.5B</td>
</tr>
<tr>
Expand Down
35 changes: 22 additions & 13 deletions demo/toggle.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,80 +52,89 @@ <h2>Column Toggle Table</h2>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="persist">Movie Title</th>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-sortable-default-col data-tablesaw-priority="3">Rank</th>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="2">Year</th>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4" colspan="2">Gross</th>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="1"><abbr title="Rotten Tomato Rating">Rating</abbr></th>
<th scope="col" data-tablesaw-sortable-col data-tablesaw-priority="4">Gross</th>
</tr>
</thead>
<tbody>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Avatar_(2009_film)">Avatar</a></td>
<td>1</td>
<td>2009</td>
<td>83%</td>
<td rowspan="2">2009</td>
<td>$2.7B</td>
<td>$2.7B</td>
<td>83%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Titanic_(1997_film)">Titanic</a></td>
<td>2</td>
<td>1997</td>
<td>88%</td>
<td>$2.1B</td>
<td>$2.1B</td>
<td>88%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/The_Avengers_(2012_film)">The Avengers</a></td>
<td>3</td>
<td>2012</td>
<td>92%</td>
<td>$1.5B</td>
<td>$1.5B</td>
<td>92%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Harry_Potter_and_the_Deathly_Hallows_%E2%80%93_Part_2">Harry Potter and the Deathly Hallows—Part 2</a></td>
<td>4</td>
<td>2011</td>
<td>96%</td>
<td>$1.3B</td>
<td>$1.3B</td>
<td>96%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Frozen_(2013_film)">Frozen</a></td>
<td>5</td>
<td>2013</td>
<td>89%</td>
<td>$1.2B</td>
<td>$1.2B</td>
<td>89%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Iron_Man_3">Iron Man 3</a></td>
<td>6</td>
<td>2013</td>
<td>78%</td>
<td>$1.2B</td>
<td>$1.2B</td>
<td>78%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Transformers:_Dark_of_the_Moon">Transformers: Dark of the Moon</a></td>
<td>7</td>
<td>2011</td>
<td>36%</td>
<td>$1.1B</td>
<td>$1.1B</td>
<td>36%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/The_Lord_of_the_Rings:_The_Return_of_the_King">The Lord of the Rings: The Return of the King</a></td>
<td>8</td>
<td>2003</td>
<td>95%</td>
<td>$1.1B</td>
<td>$1.1B</td>
<td>95%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Skyfall">Skyfall</a></td>
<td>9</td>
<td>2012</td>
<td>92%</td>
<td>$1.1B</td>
<td>$1.1B</td>
<td>92%</td>
</tr>
<tr>
<td class="title"><a href="http://en.wikipedia.org/wiki/Transformers:_Age_of_Extinction">Transformers: Age of Extinction</a></td>
<td>10</td>
<td>2014</td>
<td>18%</td>
<td>$1.0B</td>
<td>$1.0B</td>
<td>18%</td>
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit b341fe2

Please sign in to comment.