Using filters with CGridView and CArrayDataProvider

Comparing #7 with #8

Revision #8 was created by yugene yugene on Oct 22, 2013, 7:56:56 AM.

allow to filter by 0 which is needed often with drop-down filters for example

Content

[...]
*/
public function filter(array $data)
{
foreach ($data AS $rowIndex => $row) {
foreach ($this->filters AS $key => $searchValue) {
if (!
emptyis_null($searchValue) AND $searchValue !== '') {
$compareValue = null;

if ($row instanceof CModel) {
if (isset($row->$key) == false) {
throw new CException("Property " . get_class($row) . "::{$key} does not exist!");
[...]