-
Notifications
You must be signed in to change notification settings - Fork 751
Description
I'm looking for some feedback on how/where to add a tablesorter option button... kind of like shown in issue #413, but not specific for Bootstrap + font-awesome.
What I would eventually like to do is set up a plugin option something like this (data-method is some made-up - for now - data-attribute, so the plugin knows what to do with each option):
Options popup HTML
<div class="options"> <!-- hidden with css initially -->
<i class="icon-reset" data-method="sortReset">Reset Sort</i>
<i class="icon-reset" data-method="resizeReset">Reset column Sizes</i>
<hr>
<i class="icon-reset" data-method="filterReset">Reset Filters</i>
<i class="icon-toggle" data-method="toggleFilterRow">Toggle Filter Row</i>
<i class="icon-case" data-method="toggleCase" data-alt="FIlter case insensitive">Filter case sensitive</i>
<hr>
<select data-method="changeTheme">
<option>Choose a theme</option>
<option> <!-- more options here --> </option>
</select>
<i class="icon-save" data-method="saveState">Save Current State</i>
</div>Initialization
$('table').tablesorter({
// the same block can be used for multiple tables
userOptions: '.options'
});In case no user options are defined, I think each widget could automatically add some user adjustable options. This will mean more widget coding.
Positioning the options can be done by the developer, but in case none is defined, I think adding a "second" hidden caption would work - even though it isn't considered valid HTML, it appears to work in modern browsers (IE9+) - demo
<table class="tablesorter">
<caption>main caption</caption>
<!-- extra caption for table options (not valid html) -->
<caption class="options">o</caption>
<thead>
<!-- etc ... -->
</table>