Yii Advanced Filters Introduction
The Yii Advanced Filters extension improves Yii's grid view filters by allowing users to enter more powerful search terms. Multiple filter expressions can be combined together when filtering a single column, allowing for complex filters to be applied.
By default, the extension will understand the following patterns when they are entered into a grid filter:
|word1 word2 word3||All words must appear in any order.|
|"search term"||The value must match the search term exactly.|
|#search term#||The value must contain the exact search term.|
|/regex/||The value must match the regular expression pattern.|
|n1 to n2||Numerically between n1 and n2 inclusive.|
|< n1 <= n1||Numerically less than [or equal to] n1.|
|> n1 >= n1||Numerically greater than [or equal to] n1.|
|= n1||Numerically equal to n1.|
|! filter||Invert any filter listed above with an exclamation mark.|
|filter1 | filter2||The value must match at least one of the combined filters.|
|filter1 & filter2||The value must match all of the combined filters.|
For instance, the filters could be used and combined in the following ways:
|< 400 & !""||Numerically less than 400 and not blank.|
|=100 | =200 | =300||Numerically equal to either 100, 200 or 300.|
|gold & ! fool's & ! pyrite||Contains the word gold, but not fool's or pyrite.|
|/^[A-Z][0-9]+$/||A letter followed by one or more numbers (MySQL).|
|! /[A-Z]/||Does not contain any letters (MySQL).|
|1 to 100 & ! . & /$/||Even integers between 1 and 100.|
Note that with most delimiters the whitespace is optional, so <400&!"" and < 400 & ! "" are equivalent.
Currently, MySQL and SQL Server databases are supported. See the guide section about extending database helpers if you need to add support for other databases.