mcintyre321/mvc.jquery.datatables — pull request #95 by eyesnz (2014-07-17 23:14:50+00:00)
Title: Allow initial search values

Related to Set initial filter values #93

I couldn't find a way to do this with existing code, so I added the functionality myself. Adds support for the Datatables "aoSearchCols" setting, which the columnFilter plugin uses.

Notes and documentation below:

# Specifying Initial Search Values
Datatables provides the option to define an initial search for individual columns. Documentation for this feature is available on the Datatables web site at https://datatables.net/reference/option/searchCols

mvc.jquery.datatables uses the jquery.dataTables.columnFilter plugin to provide extended filtering capabilities.

## Usage
Append your initial search values to the .FilterOn method. A third parameter accepts an anonymous type to specify search values. The "sSearch" field is required, and the "bEscapeRegex" is optional.

Search fields can be set to an individual string, or be "~" separated in the case of range values. Any values are case sensitive.

NOTE: If using initial search values, then you must set StateSave to false. This is a current limitation in Datatables, where you cannot have saving of state and setting initial values at the same time.

### Example
```
vm
.FilterOn("Position", new { sSelector = "#custom-filter-placeholder-position" }, new { sSearch = "Tester" }).Select("Engineer", "Tester", "Manager")
.FilterOn("Id", null, new { sSearch = "2~4", bEscapeRegex = false }).NumberRange()
.FilterOn("IsAdmin", null, new { sSearch = "False" }).Select("True","False")
.FilterOn("Salary", new { sSelector = "#custom-filter-placeholder-salary" }, new { sSearch = "1000~100000" }).NumberRange();
vm.StateSave = false;
```

## Developer Notes
aoSearchCols = searchCols, in the upgrade to Datatables v1.10, the option was changed from "aoSearchCols" to "searchCols" (as well as "sSearch" -> "search" and "bEscapeRegex" -> "escapeRegex". The setting "aoSearchCols" is still valid in v1.10, and to be consistent with the existing settings used by mvc.jquery.datatables, the v1.9 setting value has been used.