From 4dc56d145dcf2f4a887ae0aff4aa66858e1b705e Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Fri, 20 Jul 2018 16:58:44 -0500 Subject: [PATCH] Docs: Add filter `getOptionSource` function. See #671 --- docs/index.html | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/index.html b/docs/index.html index 64ef7ac1..19a9fb9c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -7908,6 +7908,7 @@ var index, len, $table = $('table'), column = 0, // first column onlyAvail = false, // if true, available rows (visible rows after filtering) are returned + // arry is an array of all text content from a table column; duplicate entries are included! array = $.tablesorter.filter.getOptions( $table, column, onlyAvail ); // process array; sort & remove duplicates (added v2.23.4) @@ -7925,6 +7926,38 @@ $('select.external').html( opts ); + + + This filter widget function returns all the cached values of the set table column (v2.16.0): +

+ This function returns both the text and the parsed text for a column. So it ignores the filter_useParsedData option, "filter-parsed" class on the header, and the parser parsed flag settinng (ref). +

Use it as follows:

+
$.tablesorter.filter.getOptionSource( table, column, onlyAvail );
+ + Use this function as follows:
+
// external filter select
+var index, len,
+	opts = '',
+	$table = $('table'),
+	column = 0, // first column
+	onlyAvail = false, // if true, available rows (visible rows after filtering) are returned
+	// arry is an array of objects [{ text: "Foo", parsed: "foo" }, ...] with duplicates entries removed
+	arry = $.tablesorter.filter.getOptionSource( $table, column, onlyAvail );
+
+// build options
+for ( index = 0; index < len; index++ ) {
+	opts += '<option value="' + array[ index ].parsed + '">' + array[ index ].text + '</option>';
+}
+$('select.external').html( opts );
+

Please be aware that this function is different from the getOptions filter function in that an object is returned.

+
+ + + This filter widget function returns an array of sorted column data will duplicates removed (v2.23.4).