Filtersform, Carraydataprovider

Hello everyone.

Im doing a CArrayDataProvider manually and adding a filterForm in the easiest way:

$dataProvider = new CArrayDataProvider($arrayTotal, array('keyField'=>'IdSemaforo', 'pagination'=> array('pageSize'=>'15')));


			$filtersForm=new FiltersForm;

			if (isset($_GET['FiltersForm']))



			$filteredData = $filtersForm->filter($dataProvider);

			$this->render('admin', array( 'model'=>$dataProvider,


This works perfectly and filters the way i want.

The problem is that the filters dont filter the exact value, it does some kind of "like"…

Since im creating a CArrayDataProvider, i cant create a criteria. I have no clue how to do this.

There is a screenshot to show what i want. As you see i put systemCode=‘25’ and it shows me all '25’s and '25x’s… i want the 25s only :confused:

Appreciate any tips. Thank you

bump to the top

Bump to the top

solved :)

just needed to had a compare in FiltersForm Model:

public function filter(array $data)


        foreach($data AS $rowIndex => $row) {

            foreach($this->filters AS $key => $value) {

                // unset if filter is set, but doesn't match

                if(array_key_exists($key, $row) AND !empty($value)) {

		    if (strlen($row[$key]) != strlen($value))


                    if(stripos($row[$key], $value) === false)





        return $data;


Comparing the length of the strings:

if (strlen($row[$key]) != strlen($value))