Using filters with CGridView and CArrayDataProvider

Comparing #4 with #5

Revision #5 was created by Kostas Apazidis (KonApaz) Kostas Apazidis (KonApaz) on Oct 18, 2013, 11:45:54 AM.

full comparisons

Content

[...]
}

}
```

(By @KonApaz)
 
If you want to apply full comparisons (>, <, >=, <=, =) use this
 
 
 
```php 
if (substr($searchValue, 0, 2) == '<=') {
 
    if (substr($searchValue, 2) < $compareValue) {
 
        unset($data[$rowIndex]);
 
    }
 
} else if (substr($searchValue, 0, 2) == '>=') {
 
    if (substr($searchValue, 2) > $compareValue) {
 
        unset($data[$rowIndex]);
 
    }
 
} else if ($searchValue[0] == '<') {
 
    if (substr($searchValue, 1) <= $compareValue) {
 
        unset($data[$rowIndex]);
 
    }
 
} else if ($searchValue[0] == '>') {
 
    if (substr($searchValue, 1) >= $compareValue) {
 
        unset($data[$rowIndex]);
 
    }
 
} else if (stripos($compareValue, $searchValue) === false) {
 
    unset($data[$rowIndex]);
 
}
 
```
 
 
 
Controller
----------

```php
// Create filter model and set properties
$filtersForm=new FiltersForm;
[...]