Filter: fix onlyAvail setting causing a js error on init

This commit is contained in:
Mottie 2014-07-18 13:10:38 -05:00
parent 28cdec1b60
commit f8a6898168
2 changed files with 5 additions and 2 deletions

View File

@ -2342,9 +2342,11 @@ $(function(){
<td>String</td>
<td>&quot;filter-onlyAvail&quot;</td>
<td>
Filter widget: If a header contains a select dropdown and this class name, only the available (visible) options in the column will show (<span class="version">v2.10.1</span>).
Filter widget: If a header contains a select dropdown and this class name, only the available (visible) options in the column will show (<span class="version">v2.10.1</span>; <span class="version updated">v2.17.6</span>).
<div class="collapsible">
<br>
In <span class="version">v2.17.6</span>, columns with the only available class name set, that <em>are not</em> currently being filtered will only show the available options. Conversely, the column(s) with a selected option will show all options.<br>
<br>
This option is useful after one or more columns have been filtered, then the column select filter with this class applied will only show the contents of the column within the dropdown that are currently visible. See the <a href="example-widget-filter-custom.html">custom filter widget</a> demo &quot;Discount&quot; column for an example (sort the &quot;First Name&quot; column first).<br>
<br>
<span class="label label-warning">Caution:</span> The main issue with this functionality is with keyboard accessibility. If the keyboard is used to select an option, only the first and default options will be available for chosing. The only way to select other options is with the mouse.

View File

@ -1190,9 +1190,10 @@ ts.filter = {
parsed = [],
arry = false,
source = wo.filter_selectSource,
last = c.$table.data('lastSearch') || [],
fxn = $.isFunction(source) ? true : ts.getColumnData( table, source, column );
if (onlyAvail && c.$table.data('lastSearch')[column] !== '') {
if (onlyAvail && last[column] !== '') {
onlyAvail = false;
}