<commit_before># DataTables Plugin - Keep Conditions #

Store the DataTable conditions within the URL hash every time a condition is changed, such as the page, length, search or a column order, making it possible to copy/paste the URL. Once said URL is loaded, the conditions will be retrieved from the URL hash and implemented to the table on DT initialization.

### Conditions ###
The *Keep Conditions* plugin has the capability of keeping the conditions for the following:
Setting/Extension		| Name		| Key
----------------------- | --------- | -------------
Table Search String		| `search`	| `f`
Column Ordering/Sorting | `order`	| `o`
Pagination				| `page`	| `p`
Table Length			| `length`	| `l`
[Column Visibility](http://datatables.net/reference/button/colvis) (A [buttons](http://datatables.net/extensions/buttons/) extension) | `colvis` | `v`
[Scroll Position](https://datatables.net/extensions/scroller/)	| `scroller`	| `s`
[Column Reordering](http://datatables.net/extensions/colreorder/) | `colorder`	| `c`

**Note:** The only condition that I decided to *not* implement, would be the row order (for the [RowReorder](http://datatables.net/extensions/rowreorder/) extension). There are several reasons I decided not to, but primarily, because it would be difficult to know which rows were in what order, unless the [RowId](http://datatables.net/reference/option/rowId) option was used, which is mostly only for JSON or AJAX sourced tables, which I found its a pain to get rowReorder to work for those data sources anyways.

#### Links ####
* *[Live Demo](http://www.linuxdigest.org/misc/script_examples/DataTables-Keep-Conditions/examples/)*
* *[Blog Post](http://www.linuxdigest.org/blog/2015/11/17/datatables-keep-conditions-plugin-link-to-the-exact-settings-within-the-current-table/)*

### Parameters ###
Parameter 			  			| Type 		  					| Default 	| Description
------------------------------- | ----------------------------- | --------- | ------------
`keepConditions`	  			| boolean/object/string/array	| `true`  	| Main setting object, or array of conditions to enable, or string of condition keys)
`keepConditions.conditions`		| string/array					| *None*	| Conditions to enable (Array of names, or string of keys)
`keepConditions.attachEvents`	| boolean						| `true`	| Enable auto-updating of the URL hash whenever the events associated to the conditions are triggered

### API Methods ###
Method								| Parameters
----------------------------------- | ---------------------------
`keepConditions.detachEvents`		| [`conditions` *Null* (all events/conditions), *Array* (Specific events/conditions)]
`keepConditions.attachEvents`		| [`conditions` *Null* (all events/conditions), *Array* (Specific events/conditions)]
`keepConditions.structureHash`		| [`returnHash` *Null*/`false` (Updates URL hash), `true` (Returns URL Hash as string)]
`keepConditions.enableCondition`	| [`condition` *String* (Condition name/key to enable)], [`updateHash` `true` (Updates hash after condition enables)]
`keepConditions.disableCondition`	| [`condition` *String* (Condition name/key to disable)], [`updateHash` `true` (Updates hash after condition disables)]

##### Keep Conditions Button #####
Keep Conditions plugin comes with a button! As long as you properly setup the [buttons extension](http://datatables.net/extensions/buttons/), you can include the button `copyConditions`, which will display a button, when clicked, the URL will either be copied to the viewers clipboard (with the table conditions), or display an input with selected text, making it easy to copy and share the URL. An example if this is below.<commit_msg>Fixed broken table in README<commit_after># DataTables Plugin - Keep Conditions #

Store the DataTable conditions within the URL hash every time a condition is changed, such as the page, length, search or a column order, making it possible to copy/paste the URL. Once said URL is loaded, the conditions will be retrieved from the URL hash and implemented to the table on DT initialization.

### Conditions ###
The *Keep Conditions* plugin has the capability of keeping the conditions for the following:

Setting/Extension		| Name			| Key	| Links
----------------------- | ------------- | ----- | --------------
Table Search String		| `search`		| `f`	|
Column Ordering/Sorting | `order`		| `o`	|
Pagination				| `page`		| `p`	|
Table Length			| `length`		| `l`	|
Column Visibility		| `colvis` 		| `v`	| [ColVis](http://datatables.net/reference/button/colvis) (A [buttons](http://datatables.net/extensions/buttons/) extension)
Scroll Position			| `scroller`	| `s`	| [Scroller](https://datatables.net/extensions/scroller/)
Column Reordering		| `colorder`	| `c`	| [ColOrder](http://datatables.net/extensions/colreorder/)

**Note:** The only condition that I decided to *not* implement, would be the row order (for the [RowReorder](http://datatables.net/extensions/rowreorder/) extension). There are several reasons I decided not to, but primarily, because it would be difficult to know which rows were in what order, unless the [RowId](http://datatables.net/reference/option/rowId) option was used, which is mostly only for JSON or AJAX sourced tables, which I found its a pain to get rowReorder to work for those data sources anyways.

#### Links ####
* *[Live Demo](http://www.linuxdigest.org/misc/script_examples/DataTables-Keep-Conditions/examples/)*
* *[Blog Post](http://www.linuxdigest.org/blog/2015/11/17/datatables-keep-conditions-plugin-link-to-the-exact-settings-within-the-current-table/)*

### Parameters ###
Parameter 			  			| Type 		  					| Default 	| Description
------------------------------- | ----------------------------- | --------- | ------------
`keepConditions`	  			| boolean/object/string/array	| `true`  	| Main setting object, or array of conditions to enable, or string of condition keys)
`keepConditions.conditions`		| string/array					| *None*	| Conditions to enable (Array of names, or string of keys)
`keepConditions.attachEvents`	| boolean						| `true`	| Enable auto-updating of the URL hash whenever the events associated to the conditions are triggered

### API Methods ###
Method								| Parameters
----------------------------------- | ---------------------------
`keepConditions.detachEvents`		| [`conditions` *Null* (all events/conditions), *Array* (Specific events/conditions)]
`keepConditions.attachEvents`		| [`conditions` *Null* (all events/conditions), *Array* (Specific events/conditions)]
`keepConditions.structureHash`		| [`returnHash` *Null*/`false` (Updates URL hash), `true` (Returns URL Hash as string)]
`keepConditions.enableCondition`	| [`condition` *String* (Condition name/key to enable)], [`updateHash` `true` (Updates hash after condition enables)]
`keepConditions.disableCondition`	| [`condition` *String* (Condition name/key to disable)], [`updateHash` `true` (Updates hash after condition disables)]

##### Keep Conditions Button #####
Keep Conditions plugin comes with a button! As long as you properly setup the [buttons extension](http://datatables.net/extensions/buttons/), you can include the button `copyConditions`, which will display a button, when clicked, the URL will either be copied to the viewers clipboard (with the table conditions), or display an input with selected text, making it easy to copy and share the URL. An example if this is below.
{'fraction_non_alphanumeric': 0.16324588826967515, 'fraction_numerical': 0.00217479951067011, 'mean_word_length': 3.5901434809731754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1576865', 'n_tokens_mistral': 2085, 'n_tokens_neox': 1975, 'n_words': 741}