mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Doc & comment updates
This commit is contained in:
parent
4e0efdffc7
commit
e446d6ecc4
@ -2413,11 +2413,9 @@ $('table').trigger('search', false);</pre></div>
|
||||
<span class="label label-info">Important</span> Return an array of values which will be added to the filter select dropdown. This array will automatically be stripped of any duplicate values and sorted alphanumerically before being added to the select. If for some reason the custom <code>filter_selectSource</code> function does not obtain the desired array of values, return <code>false</code> and the original method of obtaining column cell content will be used.
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
<td><a href="example-widget-filter-formatter-select2.html">Example</a></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<tr id="widget-filter-serversidefiltering">
|
||||
<td><a href="#" class="permalink">filter_serversideFiltering</a></td>
|
||||
<td>Boolean</td>
|
||||
|
@ -53,6 +53,8 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
.find('.select2').select2('val', v);
|
||||
}
|
||||
},
|
||||
|
||||
// get options from table cell content or filter_selectSource (v2.16)
|
||||
updateOptions = function(){
|
||||
data = [];
|
||||
arry = ts.filter.getOptionSource(c.$table[0], indx, onlyAvail) || [];
|
||||
@ -69,6 +71,8 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
$cell.prepend('<label>' + o.cellText + '</label>');
|
||||
}
|
||||
|
||||
// don't add default in table options if either ajax or
|
||||
// data options are already defined
|
||||
if (!(o.ajax && !$.isEmptyObject(o.ajax)) && !o.data) {
|
||||
updateOptions();
|
||||
if (onlyAvail) {
|
||||
@ -79,7 +83,7 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
}
|
||||
}
|
||||
|
||||
// add a select2!
|
||||
// add a select2 hidden input!
|
||||
$('<input class="select2 select2-' + indx + '" type="hidden" />')
|
||||
.val(o.value)
|
||||
.appendTo($cell)
|
||||
@ -88,7 +92,7 @@ ts.filterFormatter.select2 = function($cell, indx, select2Def) {
|
||||
updateSelect2();
|
||||
});
|
||||
|
||||
// update spinner from hidden input, in case of saved filters
|
||||
// update select2 from filter hidden input, in case of saved filters
|
||||
c.$table.bind('filterFomatterUpdate', function(){
|
||||
// value = '/(x$|y$)/' => 'x,y'
|
||||
var val = c.$table.data('lastSearch')[indx] || '';
|
||||
|
Loading…
Reference in New Issue
Block a user