mirror of
https://github.com/Mottie/tablesorter.git
synced 2025-01-12 15:24:21 +00:00
Core: add rowFilter parameter to getColumnText
This commit is contained in:
parent
9d7f0fb26c
commit
d5a9fb6f81
9
dist/js/jquery.tablesorter.combined.js
vendored
9
dist/js/jquery.tablesorter.combined.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! tablesorter (FORK) - updated 10-18-2015 (v2.23.5)*/
|
||||
/*! tablesorter (FORK) - updated 10-19-2015 (v2.23.5)*/
|
||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
@ -940,7 +940,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
getColumnText : function( table, column, callback ) {
|
||||
getColumnText : function( table, column, callback, rowFilter ) {
|
||||
table = $( table )[0];
|
||||
var tbodyIndex, rowIndex, cache, row, tbodyLen, rowLen, raw, parsed, $cell, result,
|
||||
hasCallback = typeof callback === 'function',
|
||||
@ -957,8 +957,11 @@
|
||||
cache = c.cache[ tbodyIndex ].normalized;
|
||||
rowLen = cache.length;
|
||||
for ( rowIndex = 0; rowIndex < rowLen; rowIndex++ ) {
|
||||
row = cache[ rowIndex ];
|
||||
if ( rowFilter && !row[ c.columns ].$row.is( rowFilter ) ) {
|
||||
continue;
|
||||
}
|
||||
result = true;
|
||||
row = cache[ rowIndex ];
|
||||
parsed = ( allColumns ) ? row.slice( 0, c.columns ) : row[ column ];
|
||||
row = row[ c.columns ];
|
||||
raw = ( allColumns ) ? row.raw : row.raw[ column ];
|
||||
|
8
dist/js/jquery.tablesorter.combined.min.js
vendored
8
dist/js/jquery.tablesorter.combined.min.js
vendored
File diff suppressed because one or more lines are too long
7
dist/js/jquery.tablesorter.js
vendored
7
dist/js/jquery.tablesorter.js
vendored
@ -938,7 +938,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
getColumnText : function( table, column, callback ) {
|
||||
getColumnText : function( table, column, callback, rowFilter ) {
|
||||
table = $( table )[0];
|
||||
var tbodyIndex, rowIndex, cache, row, tbodyLen, rowLen, raw, parsed, $cell, result,
|
||||
hasCallback = typeof callback === 'function',
|
||||
@ -955,8 +955,11 @@
|
||||
cache = c.cache[ tbodyIndex ].normalized;
|
||||
rowLen = cache.length;
|
||||
for ( rowIndex = 0; rowIndex < rowLen; rowIndex++ ) {
|
||||
row = cache[ rowIndex ];
|
||||
if ( rowFilter && !row[ c.columns ].$row.is( rowFilter ) ) {
|
||||
continue;
|
||||
}
|
||||
result = true;
|
||||
row = cache[ rowIndex ];
|
||||
parsed = ( allColumns ) ? row.slice( 0, c.columns ) : row[ column ];
|
||||
row = row[ c.columns ];
|
||||
raw = ( allColumns ) ? row.raw : row.raw[ column ];
|
||||
|
4
dist/js/jquery.tablesorter.min.js
vendored
4
dist/js/jquery.tablesorter.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/js/jquery.tablesorter.widgets.js
vendored
2
dist/js/jquery.tablesorter.widgets.js
vendored
@ -1,4 +1,4 @@
|
||||
/*! tablesorter (FORK) - updated 10-18-2015 (v2.23.5)*/
|
||||
/*! tablesorter (FORK) - updated 10-19-2015 (v2.23.5)*/
|
||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
|
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
2
dist/js/jquery.tablesorter.widgets.min.js
vendored
File diff suppressed because one or more lines are too long
@ -32,7 +32,7 @@ pre.lang-js, pre.lang-javascript {border-left-color: #f1bf26;}
|
||||
pre.lang-html {border-left-color: #ef6328;}
|
||||
pre.lang-css {border-left-color: #27aae2;}
|
||||
pre,#display {background-color:#eee;font-size:small;list-style:none;}
|
||||
pre.prettyprint {padding:5px;}
|
||||
pre.prettyprint {padding:5px; white-space: pre-wrap; word-break: break-all; }
|
||||
code {background-color: #e6e6e6; padding: 1px 5px;}
|
||||
a code {text-decoration:underline;}
|
||||
pre.normal {background-color:transparent;border:none;border-left-width:0;overflow-x:auto;}
|
||||
|
@ -6832,15 +6832,16 @@ textExtractionFunction = $.tablesorter.getColumnData( table, table.config.textEx
|
||||
|
||||
<tr id="function-getcolumntext">
|
||||
<td><a href="#" class="permalink">getColumnText</a></td>
|
||||
<td>This utility function returns the entire column text (raw and parsed) as well as other data (<span class="version">v2.21.4</span>).
|
||||
<td>This utility function returns the entire column text (raw and parsed) as well as other data (<span class="version">v2.21.4</span>; <span class="updated version">v2.23.6</span>).
|
||||
<div class="collapsible">
|
||||
<br>
|
||||
Use it as follows:
|
||||
<pre class="prettyprint lang-js">$.tablesorter.getColumnText( table, column, callback );</pre>
|
||||
<pre class="prettyprint lang-js">$.tablesorter.getColumnText( table, column, callback, rowFilter );</pre>
|
||||
<ul>
|
||||
<li><code>table</code> - table DOM element (or jQuery object).</li>
|
||||
<li><code>column</code> - zero-based column index or <code>'all'</code>.</li>
|
||||
<li><code>callback</code> - callback function that is called while obtaining data for each cell within the specified column.</li>
|
||||
<li><code>rowFilter</code> - can be a jQuery selector, function or element to allow targeting specific rows (e.g. <code>":visible"</code> or <code>":not(.child-row)"</code>); this parameter is used in a jQuery <code><a class="external" href="http://api.jquery.com/is/">.is()</a></code> function (<span class="version">v2.23.6</span>).</li>
|
||||
</ul>
|
||||
When using the callback, there is only one argument (object) passed to this function; it contains the following:
|
||||
<ul>
|
||||
@ -6881,6 +6882,16 @@ $.tablesorter.getColumnText( table, 3, function( data ) {
|
||||
// parsed : [ 'cell1', 'cell2', ..., 'celln' ],
|
||||
// $cell : [ $cell1, $cell2, ..., $celln ]
|
||||
// }
|
||||
</pre>
|
||||
When using the filter widget, you can ignore filtered rows using the following code:
|
||||
<pre class="prettyprint lang-js">var table = $('table')[0],
|
||||
// targeting the 4th column (zero-based index); callback function is an empty string & therefore ignored
|
||||
columnText = $.tablesorter.getColumnText( table, 3, '', ':not(.filtered)' );
|
||||
// columnText = {
|
||||
// raw : [ 'cell1', 'cell2', ..., 'celln' ],
|
||||
// parsed : [ 'cell1', 'cell2', ..., 'celln' ],
|
||||
// $cell : [ $cell1, $cell2, ..., $celln ]
|
||||
// }
|
||||
</pre>
|
||||
All of these methods of gathering column data might be useful for custom widgets, etc.
|
||||
<p></p>
|
||||
|
@ -4,7 +4,7 @@
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
||||
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
||||
*/
|
||||
/*! tablesorter (FORK) - updated 10-18-2015 (v2.23.5)*/
|
||||
/*! tablesorter (FORK) - updated 10-19-2015 (v2.23.5)*/
|
||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
@ -946,7 +946,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
getColumnText : function( table, column, callback ) {
|
||||
getColumnText : function( table, column, callback, rowFilter ) {
|
||||
table = $( table )[0];
|
||||
var tbodyIndex, rowIndex, cache, row, tbodyLen, rowLen, raw, parsed, $cell, result,
|
||||
hasCallback = typeof callback === 'function',
|
||||
@ -963,8 +963,11 @@
|
||||
cache = c.cache[ tbodyIndex ].normalized;
|
||||
rowLen = cache.length;
|
||||
for ( rowIndex = 0; rowIndex < rowLen; rowIndex++ ) {
|
||||
row = cache[ rowIndex ];
|
||||
if ( rowFilter && !row[ c.columns ].$row.is( rowFilter ) ) {
|
||||
continue;
|
||||
}
|
||||
result = true;
|
||||
row = cache[ rowIndex ];
|
||||
parsed = ( allColumns ) ? row.slice( 0, c.columns ) : row[ column ];
|
||||
row = row[ c.columns ];
|
||||
raw = ( allColumns ) ? row.raw : row.raw[ column ];
|
||||
|
@ -928,7 +928,7 @@
|
||||
}
|
||||
},
|
||||
|
||||
getColumnText : function( table, column, callback ) {
|
||||
getColumnText : function( table, column, callback, rowFilter ) {
|
||||
table = $( table )[0];
|
||||
var tbodyIndex, rowIndex, cache, row, tbodyLen, rowLen, raw, parsed, $cell, result,
|
||||
hasCallback = typeof callback === 'function',
|
||||
@ -945,8 +945,11 @@
|
||||
cache = c.cache[ tbodyIndex ].normalized;
|
||||
rowLen = cache.length;
|
||||
for ( rowIndex = 0; rowIndex < rowLen; rowIndex++ ) {
|
||||
row = cache[ rowIndex ];
|
||||
if ( rowFilter && !row[ c.columns ].$row.is( rowFilter ) ) {
|
||||
continue;
|
||||
}
|
||||
result = true;
|
||||
row = cache[ rowIndex ];
|
||||
parsed = ( allColumns ) ? row.slice( 0, c.columns ) : row[ column ];
|
||||
row = row[ c.columns ];
|
||||
raw = ( allColumns ) ? row.raw : row.raw[ column ];
|
||||
|
@ -4,7 +4,7 @@
|
||||
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██▀▀ ▀▀▀██
|
||||
█████▀ ▀████▀ ██ ██ ▀████▀ ██ ██ ██ ██ ▀████▀ █████▀ ██ ██ █████▀
|
||||
*/
|
||||
/*! tablesorter (FORK) - updated 10-18-2015 (v2.23.5)*/
|
||||
/*! tablesorter (FORK) - updated 10-19-2015 (v2.23.5)*/
|
||||
/* Includes widgets ( storage,uitheme,columns,filter,stickyHeaders,resizable,saveSort ) */
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
|
Loading…
Reference in New Issue
Block a user