Revision #7 has been created by yugene on Oct 22, 2013, 6:32:36 AM with the memo:
full comparison is fixed (wrong order of vars / or wrong comparison at second level conditions were used)
« previous (#6) next (#8) »
Changes
Title
unchanged
Using filters with CGridView and CArrayDataProvider
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
CGridview, CArrayDataProvider, filters, filter
Content
changed
[...]
If you want to apply full comparisons (>, <, >=, <=, =) use this
```php
if (substr($searchValue, 0, 2) == '<=') {
if ($compareValue > substr($searchValue, 2)
> $compareValue) {
unset($data[$rowIndex]);
}
} else if (substr($searchValue, 0, 2) == '>=') {
if (
$compareValue < substr($searchValue, 2)
< $compareValue) {
unset($data[$rowIndex]);
}
} else if ($searchValue[0] == '<') {
if (
$compareValue >= substr($searchValue, 1)
>= $compareValue) {
unset($data[$rowIndex]);
}
} else if ($searchValue[0] == '>') {
if (
$compareValue <= substr($searchValue, 1)
<= $compareValue) {
unset($data[$rowIndex]);
}[...]
'filter'=>$filtersForm,
));
```