The tabletrim()
function takes an options object as the second parameter.
The options object is a plain Javascript object that can set any of the following properties:
Property | Type | Default | Description |
---|---|---|---|
sticky | int | 1 | Column that should remain persistent in the left column when the table is trimmed. Column indexes start at one. |
init | int | 2 |
Column that should be shown initially in the right column when the table is trimmed. Column indexes
start at one. Note that options.sticky and options.init should
not be set to the same column.
|
select | bool | true |
Whether or not the <select> dropdown box should be shown when the table is trimmed.
|
next | bool | false | Creates a next button when table is trimmed. This button activates the next column when clicked. |
prev | bool | false | Creates a previous button when table is trimmed. This button activates the previous column when clicked. |
label | boolean | false |
Creates a <label> element for the <select> dropdown.
|
nexthtml | string | › | Custom HTML to use for the next button. |
prevhtml | string | ‹ | Custom HTML to use for the previous button. |
labelhtml | string | Column: |
Custom HTML to use for the <label> element.
|
breakpoint | int | 640 |
Breakpoint (in pixels) at which to trim/untrim the table.
Note: this width is a reference to the table's width, not the width of the window. |
lag | int | 100 | Time (in milliseconds) to wait after a resize event finishes before checking to see if the breakpoint was passed. Setting this number higher can lead to better performance, but will make for a slower trim/untrim effect. |
oninit | function | null | Function to call when tabletrim finishes initializing. |
ontrim | function | null | Function to call when the table finishes trimming. |
onuntrim | function | null | Function to call when the table finishes untrimming. |
onactivate | function | null | Function to call when the table finishes activating a column. |
ondeactivate | function | null | Function to call when the table finishes activating a column. |
1
2
3
4
5
6
7
// Example options object
var options = {
autoplay: true,
onload: function {
alert('loaded');
}
}