mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Add resetToLoadState method
This commit is contained in:
parent
a6b87c7882
commit
42f363c96f
@ -3576,6 +3576,18 @@ This ajaxProcessing function must return an object with "total", "headers" and "
|
||||
<td><a href="example-add-rows.html">Example</a></td>
|
||||
</tr>
|
||||
|
||||
<tr id="resettoloadstate">
|
||||
<td><a href="#" class="permalink">resetToLoadState</a></td>
|
||||
<td>Use this method reset the table to it's original settings. (<span class="version">v2.16.5</span>).
|
||||
<div class="collapsible">
|
||||
Using this method will clear out any settings that have changed since the table was initialized (refreshes the entire table); so any sorting or modified widget options will be cleared.<br>
|
||||
However, it will not clear any values that were saved to storage. This method is basically like reloading the page.
|
||||
<pre class="prettyprint lang-js">$('table').trigger('resetToLoadState');</pre>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
|
||||
<tr id="sort">
|
||||
<td><a href="#" class="permalink">sort</a></td>
|
||||
<td>Use this method to initialize a sort while targeting a specific column header (<span class="version">v2.9</span>).
|
||||
|
@ -948,6 +948,14 @@
|
||||
.bind("destroy" + c.namespace, function(e, c, cb){
|
||||
e.stopPropagation();
|
||||
ts.destroy(table, c, cb);
|
||||
})
|
||||
.bind("resetToLoadState" + c.namespace, function(e){
|
||||
// restore original settings; this clears out current settings, but does not clear
|
||||
// values saved to storage.
|
||||
c = $.extend(true, ts.defaults, c.originalSettings);
|
||||
table.hasInitialized = false;
|
||||
// setup the entire table again
|
||||
ts.setup( table, c );
|
||||
});
|
||||
}
|
||||
|
||||
@ -957,6 +965,8 @@
|
||||
var table = this,
|
||||
// merge & extend config options
|
||||
c = $.extend(true, {}, ts.defaults, settings);
|
||||
// save initial settings
|
||||
c.originalSettings = settings;
|
||||
// create a table from data (build table widget)
|
||||
if (!table.hasInitialized && ts.buildTable && this.tagName !== 'TABLE') {
|
||||
// return the table (in case the original target is the table's container)
|
||||
|
Loading…
Reference in New Issue
Block a user