mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Filter widget: filter_cssFilter can now contain an array of class names to apply
This commit is contained in:
parent
58528d3d79
commit
6d379a78b4
@ -1850,10 +1850,12 @@ $(function(){
|
||||
|
||||
<tr id="widget-filter-cssfilter">
|
||||
<td><a href="#" class="permalink">filter_cssFilter</a></td>
|
||||
<td>String</td>
|
||||
<td>String or Array</td>
|
||||
<td>""</td>
|
||||
<td>Additional CSS class applied to each filter - <span class="version updated">v2.11</span>
|
||||
<td>Additional CSS class applied to each filter - <span class="version updated">v2.14.6</span>
|
||||
<div class="collapsible"><br>
|
||||
As of v2.14.6, this option can also contain an array of class names that are to be applied to input filters.<br>
|
||||
<br>
|
||||
Changed to empty string in v2.11, as the <code>"tablesorter-filter"</code> class will always be added to the filter; this option now contains any additional class names to add.
|
||||
<p>Use the <a href="#widget-filter-cssfilter"><code>"tablesorter-filter"</code></a> option to add an extra css class name as follows:</p>
|
||||
<pre class="prettyprint lang-javascript">$(function(){
|
||||
@ -1861,6 +1863,7 @@ $(function(){
|
||||
widgets: ["filter"],
|
||||
widgetOptions : {
|
||||
// css class applied to the table row containing the filters & the inputs within that row
|
||||
// or [ "filter1", "filter2", "filter3", etc... ]
|
||||
filter_cssFilter : "tablesorter-filter"
|
||||
}
|
||||
});
|
||||
|
@ -653,7 +653,7 @@ ts.filter = {
|
||||
return filters;
|
||||
},
|
||||
buildRow: function(table, c, wo) {
|
||||
var column, $header, buildSelect, disabled,
|
||||
var column, $header, buildSelect, disabled, name,
|
||||
// c.columns defined in computeThIndexes()
|
||||
columns = c.columns,
|
||||
buildFilter = '<tr class="tablesorter-filter-row">';
|
||||
@ -699,7 +699,11 @@ ts.filter = {
|
||||
}
|
||||
}
|
||||
if (buildFilter) {
|
||||
buildFilter.addClass('tablesorter-filter ' + wo.filter_cssFilter).attr('data-column', column);
|
||||
// add filter class name
|
||||
name = ( $.isArray(wo.filter_cssFilter) ?
|
||||
(typeof wo.filter_cssFilter[column] !== 'undefined' ? wo.filter_cssFilter[column] || '' : '') :
|
||||
wo.filter_cssFilter ) || '';
|
||||
buildFilter.addClass('tablesorter-filter ' + name).attr('data-column', column);
|
||||
if (disabled) {
|
||||
buildFilter.addClass('disabled')[0].disabled = true; // disabled!
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user