ColumnSelector: add columnSelector_updated option

This option contains the triggered event name, which is "columnUpdate" by default
This commit is contained in:
Mottie 2015-08-21 16:58:21 -05:00
parent 47de48ef5d
commit 90e0355b4a
4 changed files with 24 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -170,6 +170,7 @@
<h3><a href="#">Notes</a></h3> <h3><a href="#">Notes</a></h3>
<div> <div>
<ul> <ul>
<li>In <span class="version">v2.23.2</span>, added <code>columnSelector_updated</code> option.</li>
<li>In <span class="version updated">v2.23.0</span>, updated methods to allow refreshing the content of the container &amp; enchanced ability to set both auto and columns modes.</li> <li>In <span class="version updated">v2.23.0</span>, updated methods to allow refreshing the content of the container &amp; enchanced ability to set both auto and columns modes.</li>
<li>In <span class="version updated">v2.19.0</span>, the <code>refreshColumnSelector</code> method has been updated to allow passing a parameter. Pass an array of zero-based column indexes of columns to show, or any non-array to enable auto mode (if available).</li> <li>In <span class="version updated">v2.19.0</span>, the <code>refreshColumnSelector</code> method has been updated to allow passing a parameter. Pass an array of zero-based column indexes of columns to show, or any non-array to enable auto mode (if available).</li>
<li>In <span class="version">v2.18.4</span>, added <code>columnSelector_cssChecked</code> option which contains the class name added to checked inputs. This helps fix an issue in Chrome that rears it's ugly head when trying to use <code>input:checked</code> to change a Font Awesome icon. See <a href="http://jsfiddle.net/2tu38gez">this demo</a> by TheSin which uses this option to change the checkbox style.</li> <li>In <span class="version">v2.18.4</span>, added <code>columnSelector_cssChecked</code> option which contains the class name added to checked inputs. This helps fix an issue in Chrome that rears it's ugly head when trying to use <code>input:checked</code> to change a Font Awesome icon. See <a href="http://jsfiddle.net/2tu38gez">this demo</a> by TheSin which uses this option to change the checkbox style.</li>
@ -385,6 +386,22 @@
</td> </td>
</tr> </tr>
<tr id="column-selector-updated">
<td><a href="#" class="permalink">columnSelector_updated</a></td>
<td>
This event is triggered after the columnSelector has completed updating (<span class="version">v2.23.2</span>)
<div class="collapsible">
<br>
<p>Bind to this event if you to need to perform an action after the columnSelector has finished hiding or showing columns.</p>
Use it as follows<pre class="prettyprint lang-js">$('table').on('columnUpdate', function(){
// set ascending sort on first column
$(this).trigger('sorton', [ [[0,0]] ]);
});</pre>
Default value: <code>'columnUpdate'</code>
</div>
</td>
</tr>
</tbody> </tbody>
</table> </table>

View File

@ -478,7 +478,7 @@
<li><span class="label label-info">Beta</span> <a href="example-widget-chart.html">Chart Widget</a> (<span class="version">v2.19.0</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-widget-chart.html">Chart Widget</a> (<span class="version">v2.19.0</span>).</li>
<li><span class="results">&dagger;</span> <a href="example-widget-columns.html">Columns highlight widget</a> (v2.0.17)</li> <li><span class="results">&dagger;</span> <a href="example-widget-columns.html">Columns highlight widget</a> (v2.0.17)</li>
<li><a href="example-widget-column-selector.html">Column selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.23.0</span>).</li> <li><a href="example-widget-column-selector.html">Column selector widget</a> (<span class="version">v2.15</span>; <span class="version updated">v2.23.2</span>).</li>
<li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.23.0</span>).</li> <li><a href="example-widget-editable.html">Content editable widget</a> (v2.9; <span class="version updated">v2.23.0</span>).</li>
<li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.19.0</span>).</li> <li><span class="label label-info">Beta</span> <a href="example-dragtable.html">Dragtable mod</a> - (jQuery UI widget for column reordering [<a href="http://stackoverflow.com/a/27770224/145346">ref</a>]; <span class="version">v2.19.0</span>).</li>
<li><span class="results">&dagger;</span> Filter widget (<span class="version updated">v2.23.2</span>): <li><span class="results">&dagger;</span> Filter widget (<span class="version updated">v2.23.2</span>):

View File

@ -224,7 +224,7 @@
} }
// trigger columnUpdate if auto is true (it gets skipped in updateCols() // trigger columnUpdate if auto is true (it gets skipped in updateCols()
if (colSel.auto) { if (colSel.auto) {
c.$table.trigger('columnUpdate'); c.$table.trigger(wo.columnSelector_updated);
} }
}, },
@ -299,7 +299,7 @@
if (wo.columnSelector_saveColumns && ts.storage) { if (wo.columnSelector_saveColumns && ts.storage) {
ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states ); ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states );
} }
c.$table.trigger('columnUpdate'); c.$table.trigger(wo.columnSelector_updated);
}, },
attachTo : function(table, elm) { attachTo : function(table, elm) {
@ -370,7 +370,9 @@
columnSelector_priority : 'data-priority', columnSelector_priority : 'data-priority',
// class name added to checked checkboxes - this fixes an issue with Chrome not updating FontAwesome // class name added to checked checkboxes - this fixes an issue with Chrome not updating FontAwesome
// applied icons; use this class name (input.checked) instead of input:checked // applied icons; use this class name (input.checked) instead of input:checked
columnSelector_cssChecked : 'checked' columnSelector_cssChecked : 'checked',
// event triggered when columnSelector completes
columnSelector_updated : 'columnUpdate'
}, },
init: function(table, thisWidget, c, wo) { init: function(table, thisWidget, c, wo) {