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

Commit

Permalink
Slight modification to config examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Apr 13, 2017
1 parent 42c8070 commit 9c8276c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
12 changes: 5 additions & 7 deletions README.md
Expand Up @@ -57,7 +57,7 @@ The Column Toggle Table allows the user to select which columns they want to be
| Add a Mini-Map | The little dots that appear next to the column toggle popup. Use the `data-tablesaw-minimap` attribute: `<table data-tablesaw-mode="columntoggle" data-tablesaw-minimap>` |

<details>
<summary>_Advanced Option_: Prioritize Columns</summary>
<summary><em>Advanced Option</em>: Prioritize Columns</summary>

Table headers must have a `data-tablesaw-priority` attribute to be eligible to toggle. `data-tablesaw-priority` is a numeric value from 1 to 6, which determine default breakpoints at which a column will show. The breakpoint defaults are:

Expand Down Expand Up @@ -97,17 +97,15 @@ Allows the user to use the swipe gesture (or use the left and right buttons) to
| Disable swipe touch events | Use the `<table data-tablesaw-no-touch>` attribute to opt-out of swiping left or right to navigate columns. Users will need to use the provided buttons instead. |

<details>
<summary>_Advanced Option_: Configure Swipe Thresholds</summary>
<summary><em>Advanced Option</em>: Configure Swipe Thresholds</summary>

Add a `TablesawConfig` object to your page in a `<script>` element. It doesn’t matter if it’s declared before or after the Tablesaw JavaScript.

```js
<script>
TablesawConfig = {
swipe: {
horizontalThreshold: 15,
verticalThreshold: 20
}
swipeHorizontalThreshold: 15,
swipeVerticalThreshold: 20
};
</script>
```
Expand Down Expand Up @@ -167,7 +165,7 @@ Use `data-tablesaw-sortable-switch` to add a select form element to manually cho
![](docs/sortable.png)

<details>
<summary>_Advanced Option_: Custom Sort Functions</summary>
<summary><em>Advanced Option</em>: Custom Sort Functions</summary>

Tablesaw provides two methods of sorting built-in: string and numeric. To use numeric sort, use the `data-tablesaw-sortable-numeric` class as shown in the above sorting markup example. Otherwise, tablesaw uses a case insensitive string sort.

Expand Down
6 changes: 2 additions & 4 deletions demo/swipe-config.html
Expand Up @@ -12,10 +12,8 @@

<script>
TablesawConfig = {
swipe: {
horizontalThreshold: 20, // default is 15
verticalThreshold: 40 // default is 30
}
swipeHorizontalThreshold: 20, // default is 15
swipeVerticalThreshold: 40 // default is 30
};
</script>
<script src="../dist/tablesaw.js"></script>
Expand Down
1 change: 1 addition & 0 deletions src/tables.swipetoggle.js
Expand Up @@ -255,6 +255,7 @@
// This config code is a little awkward because shoestring doesn’t support deep $.extend
// Trying to work around when devs only override one of (not both) horizontalThreshold or
// verticalThreshold in their TablesawConfig.
// @TODO major version bump: remove cfg.swipe, move to just use the swipePrefix keys
var verticalThreshold = cfg.swipe ? cfg.swipe.verticalThreshold : cfg.swipeVerticalThreshold;
var horizontalThreshold = cfg.swipe ? cfg.swipe.horizontalThreshold : cfg.swipeHorizontalThreshold;

Expand Down

0 comments on commit 9c8276c

Please sign in to comment.